[Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-15 Thread Sanjaya Kumar Patel
Hi Jonathan, I did some work using "__autoload__ = True." Seems to work perfectly, also with relations. Thanks a lot for the unimaginabley quick support! However, I am facing some problem while trying to relate a table to itself using a many-to-many association table. This is definitely an inde

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Jonathan LaCour
William K. Volkman wrote: > Additionally that is a programmer centric view, something that would > only be applicable to small projects. Once you get 10s of developers > involved chaos ensues until a DBA is appointed to analyze, normalize, > and document the data requirements. Even in small syst

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread William K. Volkman
On Fri, 2006-07-14 at 10:46, Jonathan Ellis wrote: > On 7/14/06, Jonathan LaCour <[EMAIL PROTECTED]> wrote: > Really, when you think about it, defining the schema in the > code is > more adherent to DRY than autoloading, since instead of having > 1 DDL > scri

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Jonathan Ellis
On 7/14/06, Jonathan LaCour <[EMAIL PROTECTED]> wrote: Really, when you think about it, defining the schema in the code ismore adherent to DRY than autoloading, since instead of having 1 DDLscript for every database you support, you just have it stated in codeone time ;) Except you still cant defin

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Jonathan LaCour
Sanjaya Kumar Patel wrote: > Is something like this possible, that the tables are autoloaded, along > with foreign keys, but the relations are defined in the code. I think > this is what is done in SQLAlchemy when you do autoload? > > So, something like this? > > [snip snip code] This is what I w

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Jonathan LaCour
Michael Bayer wrote: >> Note that you absolutely *must* have the activemapper metadata bound >> before you declare your classes, or everything will blow up. It >> does not yet support relationships (and might not ever, from what >> Mike stated in his response to me earlier in the thread). > > > w

[Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Sanjaya Kumar Patel
Thanks for the elaborated replies. Is something like this possible, that the tables are autoloaded, along with foreign keys, but the relations are defined in the code. I think this is what is done in SQLAlchemy when you do autoload? So, something like this? class Employee(ActiveMapper):

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Michael Bayer
On Jul 14, 2006, at 11:04 AM, Jonathan LaCour wrote: > > Note that you absolutely *must* have the activemapper metadata bound > before you declare your classes, or everything will blow up. It does > not yet support relationships (and might not ever, from what Mike > stated in his response to me

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Jonathan LaCour
> Its not *currently* possible, however I don't think it would be hard > at all to put in something like this into ActiveMapper: Well, that was easy. Check out revision 1708. It lets you do the following: from sqlalchemy.ext.activemapper import * import sqlalchemy.ext.activemapper as

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Michael Bayer
On Jul 14, 2006, at 9:29 AM, Jonathan LaCour wrote: > I don't really know anything about how relationships are detected in > SQLAlchemy when you use autoloading, so I am not sure if doing that > part is possible, but using the existing infrastructure to load the > columns themselves should be fai

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Jonathan LaCour
Charles Duffy wrote: > I don't think autoloading is possible with ActiveMapper (doesn't it > defeat the point?) Its not *currently* possible, however I don't think it would be hard at all to put in something like this into ActiveMapper: class Person(ActiveMapper): class mapping:

Re: [Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Charles Duffy
Sanjaya Kumar Patel wrote: > Dear All, > > I am not being able to figure out how relate to a table having composite > primary key. To illustrate my problem, I am giving below a schema. Any > guidence on how to code this in SQLAlchemy (and in ActiveMapper, if > possible) is more than appreciable

[Sqlalchemy-users] How to relate to a table having composite primary key

2006-07-14 Thread Sanjaya Kumar Patel
Dear All, I am not being able to figure out how relate to a table having composite primary key. To illustrate my problem, I am giving below a schema. Any guidence on how to code this in SQLAlchemy (and in ActiveMapper, if possible) is more than appreciable. I would prefer autoloding Tables, rat