Hi Michael, the problem does not occur, when the autoincrement is set to True, so your fix works correctly. The problem of the generated id not being set only turned up again, when I was experimenting with autoincrement=False (to fix the dialect problem at table creation time) in conjunction with an execute_at-DDL after the creation that re-enabled the autoincrement on the id column. So the fact, that the id was not correctly set on dependent instances was actually quite logical because SQLA could not know about the column being an autoincremented value. The autoincrement-option in the SQLA-schema-defintion was set to False and SQLA will probably not examine the database's metadata in order to find out which column is autogenerated :-)
So to make a long story short: with autoincrement=True, the 0.6 branch and the fixed mysql dialect, everything works as expected. Christian On 4 Aug., 17:53, "Michael Bayer" <[email protected]> wrote: > Christian Schwanke wrote: > > > Hi Michael, > > > thanks for your quick reply (again). > > I'm currently on the 0.6 branch after I ran into the first problem a > > few days ago but in my actual schema, the autogenerated ID in the > > second PK-column is referenced by another table that is mapped as a > > one-to-many relation. When persisting the model with an entry in the > > unsaved relation, the generated id is not "cascaded" to the related > > item, when autoincrement is set to False on the id column (using the > > execute_at solution to fix the table definition). > > but this is exactly the bug I fixed this weekend. you do need > autoincrement=True on the column that reports its newly generated value > via cursor.lastrowid, and I would turn off autoincrement=True on any other > primary key columns. if that doesn't work please post a full test case on > trac. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
