Hi, I am using sqlalchemy like this:
class Entry: pass table1 = sqa.Table('table1', meta, autoload=True) # this table has primary key 'id' table2 = sqa.Table('table2', meta, sqa.Column('table1_id', sqa.Integer, sqa.ForeignKey('table1.id'), autoload=True) table1 = table1.join(table2) # gets joined on the ForeignKey, a.k.a. table2.table1_id == table1.id sqa_orm.mapper(Entry, table1) session = sqa_orm.create_session() entry = Entry() entry.a = 1 ... # working with entry, setting values for all columns except id and table1_id session.save(entry) session.flush() But now, the entry in table2 gets stored, but with NULL value in table1_id column. I would expect sqlalchemy to be the same smart as it is already with the join, and set table2.table1_id to the corresponding table1.id, because it knows about the foreign key. Any more direct way to achieve this than to use properties and relations (which would require two classes (Entry1, Entry2) mapped to each table separately as opposed to just Entry mapped to a table join)? Thanks for any suggestions and cheers, Boris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---