Robert Leftwich wrote:

        engine.execute(
'''CREATE TABLE foo_membership(
            baz_code VARCHAR(7) NOT NULL,
            baz_date TIMESTAMP NOT NULL,
            foo_code VARCHAR(7) NOT NULL,
            foo_date TIMESTAMP NOT NULL,
FOREIGN KEY(baz_code, baz_date) REFERENCES baz_daily(code, date), FOREIGN KEY(foo_code, foo_date) REFERENCES foo_daily(code, date),
            PRIMARY KEY (baz_code, baz_date, foo_code, foo_date)
)''', {})


Forgot to add the matching Table:

Table('foo_membership', engine,
Column('baz_code', String(7), ForeignKey('baz_daily.code'), primary_key=True),
      Column('baz_date', DateTime, ForeignKey('baz_daily.date'), 
primary_key=True),
Column('foo_code', String(7), ForeignKey('foo_daily.code'), primary_key=True),
       DateTime, ForeignKey('foo_daily.date'), primary_key=True))

This should work for most uses but I imagine there are several mapping scenarios that would not work without fully specifying the primary and secondary joins due to each of the foreign keys being specified individually.

Robert


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to