On Feb 7, 2:06 am, Werner Thie <[EMAIL PROTECTED]> wrote: > > No problem to define a one to many relation from AAA > BBB so far. > Now, as it always goes with 'legacy', some clever guy added another > table, again with a one to many relation from AAA > CCC with a catch: > > ccc = Table( 'CCC', > metadata, > Column('pk4', String(6), primary_key=True), > Column('pk3', Integer, primary_key=True)) > > where pk4 is the concatenation of pk1 and pk2. >
I'm not a database/sql expert, but I don't think its possible (certainly never heard of it) to map 2 distinct columns to a single concatenation of a those 2 columns. As far as the database is concerned they're completely different. If possible, split the columns up in that table (hopefully there aren't too many records?). If its not (yay legacy), perhaps creating an intersection table from AAA -> CCC: A_to_C(pk1_fk, pk2_fk, pk4_fk); that might give you enough leeway to accomplish what you want. I don't know enough about sqlalchemy to say if it can or can't. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---