[sqlalchemy] Re: Problems with composite primary key and nested relations

2009-08-03 Thread Christian Schwanke
Hi Michael, thanks for your effort, glad to hear that the issue is resolved! On 1 Aug., 02:37, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 31, 2009, at 7:20 PM, Michael Bayer wrote: I will investigate a way such that the dialect more intelligently selects the primary key column

[sqlalchemy] Re: Problems with composite primary key and nested relations

2009-07-31 Thread Michael Bayer
the issue is that the mysql dialect assumes cursor.lastrowid applies to the first primary key column in the table. Build your tables like this and it works: table_b = Table('table_b', metadata, Column('id', Integer(), nullable=False, primary_key=True), Column('a_id', Integer(),

[sqlalchemy] Re: Problems with composite primary key and nested relations

2009-07-31 Thread Michael Bayer
On Jul 31, 2009, at 7:20 PM, Michael Bayer wrote: I will investigate a way such that the dialect more intelligently selects the primary key column which recieves AUTOINCREMENT behavior. since lots of work has been going on with last_inserted_ids() in 0.6, which is soon going to trunk, this

[sqlalchemy] Re: Problems with composite primary key and nested relations

2009-07-30 Thread Michael Bayer
Christian Schwanke wrote: metadata = MetaData() table_a = Table('table_a', metadata, Column('id', Integer(), primary_key=True), Column('name', String(20), nullable=True), ) table_b = Table('table_b', metadata, Column('a_id', Integer(), nullable=False, primary_key=True),

[sqlalchemy] Re: Problems with composite primary key and nested relations

2009-07-30 Thread Michael Bayer
Im sorry, I misread that ItemC links to ItemB only since I missed the a_id coluimn on B. The issue has to do with MySQLdb's autoincrement not being reported to lastrowid properly (or the autoincrement not firing at all, I dont have time to check right now, but you can experiment by