[sqlalchemy] Re: difficult error from Base.metadata.create_all(engine)

2011-04-03 Thread farcat
OK, after a long day of experimentation ... I found a solution. This is the new code (compare to old copied in above): -- class tablemeta(DeclarativeMeta): def __new__(mcls, typedef): return

Re: [sqlalchemy] Re: difficult error from Base.metadata.create_all(engine)

2011-04-03 Thread Michael Bayer
On Apr 3, 2011, at 11:50 AM, farcat wrote: The problem seemed to be in the order of adding relationships. The main difference is that now i call DeclarativeMeta.__init__ before adding relationships. Even using a dict with relationship attributes as last argument to __init__ did not work.(

[sqlalchemy] when is object.id initialized

2011-04-03 Thread farcat
Hi all, I use a kind of dynamic reference from parent_table to other tables. For that parent_table uses columns table_name and a record_id. This makes it possible to have a reference from parent_table to any record in any table in the database. However, say that i want to reference a record of

Re: [sqlalchemy] when is object.id initialized

2011-04-03 Thread Michael Bayer
Integer primary key identifiers are generated by the database itself using a variety of techniques which are all database-dependent. This process occurs when the session flushes. If you read the object relational tutorial starting at

[sqlalchemy] Re: difficult error from Base.metadata.create_all(engine)

2011-04-03 Thread farcat
Hi Michael, Could cls.links.member_name == mem.name have been the problem? mem.name is just a string. cls and cls.links are classes/tables (links is just an extra attribute in cls). Regards, Lars Ce On Apr 3, 6:53 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Apr 3, 2011, at 11:50 AM,