By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,922 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,922 IT Pros & Developers. It's quick & easy.

Pythonic ORM with support for composite primary/foreign keys?

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.