Hi, Why undermentioned code will not work with SA 0.2.6 anymore?
After rinning: | #!/usr/bin/python | | from sqlalchemy import * | from sqlalchemy.mods.threadlocal import assign_mapper | | class Foo(object): | class Bar(object): | pass | def __init__(self, url): | metadata = BoundMetaData(url) | table = Table('test', metadata, | Column('test_id', Integer), | Column('foo', Boolean)) | assign_mapper(self.Bar, table) | | tmp = Foo("sqlite://") | #del tmp | tmp2 = Foo("sqlite://") I'm getting this: Traceback (most recent call last): File "./test.py", line 18, in ? tmp2 = Foo("sqlite://") File "./test.py", line 14, in __init__ assign_mapper(self.Bar, table) File "/usr/lib/python2.3/site-packages/sqlalchemy/mods/threadlocal.py", line 33, in assign_mapper assignmapper.assign_mapper(objectstore.context, class_, *args, **kwargs) File "/usr/lib/python2.3/site-packages/sqlalchemy/ext/assignmapper.py", line 31, in assign_mapper m = mapper(class_, extension=extension, *args, **kwargs) File "/usr/lib/python2.3/site-packages/sqlalchemy/orm/__init__.py", line 49, in mapper return Mapper(class_, table, *args, **params) File "/usr/lib/python2.3/site-packages/sqlalchemy/orm/mapper.py", line 133, in __init__ self._compile_class() File "/usr/lib/python2.3/site-packages/sqlalchemy/orm/mapper.py", line 414, in _compile_class raise exceptions.ArgumentError("Class '%s' already has a primary mapper defined. Use is_primary=True to assign a new primary mapper to the class, or use non_primary=True to create a non primary Mapper" % self.class_) sqlalchemy.exceptions.ArgumentError: Class '<class '__main__.Bar'>' already has a primary mapper defined. Use is_primary=True to assign a new primary mapper to the class, or use non_primary=True to create a non primary Mapper -- -=[ Piotr Ozarowski ]=- -=[ http://www.ozarowski.pl ]=-
pgpNSRtFhlHSd.pgp
Description: PGP signature
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users