Tim Lesher wrote:
> I'm using SQLAlchemy, reflecting from an existing MySQL database. I
> want to override two DateTime columns to provide proper "created" and
> "updated" timestamps (since MySQL can't handle auto-updating two
> TIMESTAMP columns in the same row).
> 
> According to the SA docs, this should work; however, when I autoload
> my Table objects, I get the error:
> 
> <class 'sqlalchemy.exceptions.ArgumentError'>: Table 'tablename' is
> already defined for this MetaData instance.
> 
> This short example illustrates the issue; the test_users table fails
> to load.  The error goes away if I either remove the foreign key
> constraints in the 'test_pets' table, or remove the Column overrides
> from the 'test_users' table.
> 
> It seems as if SA is instantiating the users mapper first (because the
> pets table refers to it), but not paying attention to the override; it
> then tries to instantiate the users mapper to effect the override, but
> fails.

You just need to swap the order of the two autoloads here.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to