[sqlalchemy] Having trouble using classes in different modules with the same name with declarative setup.

2012-08-21 Thread jers
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?

-- 
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 sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] Having trouble using classes in different modules with the same name with declarative setup.

2012-08-21 Thread jers
Good to hear, thanks!

On Tuesday, August 21, 2012 5:19:49 PM UTC-4, Michael Bayer wrote:


 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 sqlal...@googlegroups.comjavascript:
 .
 To unsubscribe from this group, send email to 
 sqlalchemy+...@googlegroups.com javascript:.
 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 view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/8jPpgq5NacAJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.