On Aug 21, 2012, at 4:36 PM, jers wrote:

> To give an example I have I have two classes that have the same name, but 
> belong to different modules.  there is an accounts.py that has a class 
> Account(Base), and a testing.py that has a class Account(Base).
> 
> When I try to set this up I get warnings:
> 
> The classname 'Account' is already in the registry of this declarative base
> 
> 
> 
> Is there any way I can get around this without having to change my class 
> names?
> 

In 0.8, when using string-based configuration, you'll be able to refer to 
classes of the same name in different modules using a module-qualified 
pathname.    

However, this warning is harmless and only means you can't refer to those 
classes via string name when you use relationship().  You need to either use 
the class directly:

        relationship(Account)

or a lambda in conjunction with making sure the calling module has Account 
available when all the mappings are complete:

        relationship(lambda: Account)


> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/sqlalchemy/-/wGUh_akx25IJ.
> 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.

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

Reply via email to