473,287 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Pythonic ORM with support for composite primary/foreign keys?

Hello,

so far it seems to me as if the only ORM module for Python which
supports composite primary/foreign keys was SQLAlchemy. Which looks a
little bit "overbloated" for my needs: I "just" need to be able to
define a "logical model" (à la UML) in Python and have the ORM connect
to a database (running on PostgreSQL in my case) which uses a
corresponding (pre-defined) "physical model" as its schema.

Modeling really does look exactly like what I need. Among others, it
seems to be understandable even for a Clueless Python Scripting
Dilettant like me. But support for primary keys is not yet completely
built-in (and tested).

So, is there another ORM module for Python besides SQLAlchemy which
supports composite porimary (and foreign) keys, and maybe also other
more "advanced", maybe even some of the PostgreSQL-specific features
(such as e.g. composite types)?

TIA,

Sincerely,

Wolfgang Keller
Nov 6 '07 #1
4 2946
Wolfgang Keller wrote:
so far it seems to me as if the only ORM module for Python which
supports composite primary/foreign keys was SQLAlchemy. Which looks a
little bit "overbloated" for my needs: I "just" need to be able to
define a "logical model" (à la UML) in Python and have the ORM connect
to a database (running on PostgreSQL in my case) which uses a
corresponding (pre-defined) "physical model" as its schema.
I think if your model is complex enough that you need composite foreign
keys, the project might deserve SQLAlchemy.

Mapping a bunch of python classes to an efficient DBMS schema is not
easy by any definition of "easy".

Google for "orm vietnam"... it might also be useful to read "The Art of
SQL" even if you don't plan to write SQL by hand.

Nov 6 '07 #2
Django has a wonderful ORM that can be used separately from the
framework, but it is pretty top-heavy as well. I'm afraid that size
is the price you pay for abstraction. Your business logic code
shrinks, but the supporting libraries grow.

Nov 6 '07 #3
On Nov 6, 8:29 am, Jeff <jeffo...@gmail.comwrote:
Django has a wonderful ORM that can be used separately from the
framework, but it is pretty top-heavy as well. I'm afraid that size
is the price you pay for abstraction. Your business logic code
shrinks, but the supporting libraries grow.
But the OP specifically asked for composite keys, which Django's ORM
does not support.

....
Jay

Nov 6 '07 #4
jay graves wrote:
On Nov 6, 8:29 am, Jeff <jeffo...@gmail.comwrote:
>Django has a wonderful ORM that can be used separately from the
framework, but it is pretty top-heavy as well. I'm afraid that size
is the price you pay for abstraction. Your business logic code
shrinks, but the supporting libraries grow.

But the OP specifically asked for composite keys, which Django's ORM
does not support.
SQLAlchemy is the way to go, for his use case. If he wants a
more concise and easier to use syntax, he can install Elixir
(http://elixir.ematia.de), which makes things look a bit more familiar.

Elixir does support composite primary keys.

--
Jonathan LaCour
http://cleverdevil.org

Nov 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Girish Agarwal | last post by:
Hi All, I have a database consisting of 2 tables. patient_info ( Patient Information ).Looks like lastname VARCHAR(10) fname VARCHAR(10) ssno INT(9) PRIMARY KEY ID INT(4) AUTO_INCREMENT ...
6
by: Andreas | last post by:
Hello list, what about uniqueness of inherited primary keys ? eg you have : create table objects ( id int4, date_created timestamp(0), primary key (id)
18
by: Thomas A. Anderson | last post by:
I am a bit confused in creating a composite primary key. I have three table with two of the tables containing primary keys. I have two of the tables (each with a primary key) having one to many...
4
by: Ismail Rajput | last post by:
Is there any option we can use Composite DataKeyField in the DataList and DataGrid?
4
by: Kenneth McDonald | last post by:
I need to do some data manipulation, and SQLite is a nice little product for it, except of course that I'd need to write SQL. Are there any good libraries out there that let one write (basic)...
2
by: bobby_b_ | last post by:
I have a table where fields 1 and 2 make up the primary key. Because of this, I have a unique composite index on fields 1 and 2 (as required by DB2). Now my question is: Fields 1 and 2 are also...
6
by: mac | last post by:
Summary: 1. I want to define a column in anMS Access table to be lookups on other tables. 2. The table that is the data source (e.g the "parent" table) has a composite primary key. 3. When...
7
by: Ronald S. Cook | last post by:
My client manager likes concatenated/composite primary keys. I don't. Can anyone forward any arguments pro or con? Thanks, Ron
1
by: mallz | last post by:
hi, i have two tables: table1: mid,name table2: mid,did,location now, i need to increment against a particular mid value.... how can that be done? please help.
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.