472,328 Members | 996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 2866
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 ...
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),...
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...
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...
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...
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"...
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...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.