Re: [sqlalchemy] Strange Error: FlushError: Instance has a NULL identity key.

2011-05-22 Thread Michael Bayer
SQLAlchemy doesn't consider a primary key column that is also a foreign key to another column to be "autogenerating" of a new primary key value. So it is not fetched here due to the FK on child.id. If the SQLite database here had foreign key constraints enabled the below operation would fail

[sqlalchemy] Strange Error: FlushError: Instance has a NULL identity key.

2011-05-22 Thread Massi
Hi everyone, I'm writing a script using sqlalchemy 0.66 and sqlite3. In my script I'm trying to set up a one to one relation between two tables via ORM. Here is a simplified code showing my situation: from sqlalchemy import * from sqlalchemy.orm import * class Parent(object) : def __init__(se

[sqlalchemy] Re: creating tables and mappers multiple times in the same python script

2011-05-22 Thread Faheem Mitha
[This message has also been posted.] On Fri, 20 May 2011 09:44:36 -0400, Michael Bayer wrote: > OK so not just schema names, table structure as well. So yeah so > you're using the same classes among entirely different databases > essentially, so yeah just like our tests do, just tear down befor