importing differently, relatively causes it to reprocess the model and tries to
create a new
mapper. We need to work around this.
>>> from categories.models import *
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/mtrier/Development/django-
sqlalchemy/tests/apps/../apps/categories/models.py", line 5, in <module>
class Category(models.Model):
File "/Users/mtrier/Development/django-sqlalchemy/django_sqlalchemy/models/base.py", line
139, in __init__
cls.__mapper__ = mapper_cls(cls, table, properties=our_stuff, **mapper_args)
File "/Library/Python/2.5/site-packages/sqlalchemy/orm/__init__.py", line 566, in mapper
return Mapper(class_, local_table, *args, **params)
File "/Library/Python/2.5/site-packages/sqlalchemy/orm/mapper.py", line 175, in __init__
self.__compile_class()
File "/Library/Python/2.5/site-packages/sqlalchemy/orm/mapper.py", line 784, in
__compile_class
raise exceptions.ArgumentError("Class '%s' already has a primary mapper defined with entity
name '%s'. Use non_primary=True to create a non primary Mapper.
clear_mappers() will remove
*all* current mappers from all classes." % (self.class_, self.entity_name))
ArgumentError: Class '<class 'apps.categories.models.Category'>' already has a
primary mapper
defined with entity name 'None'. Use non_primary=True to create a non primary
Mapper.
clear_mappers() will remove *all* current mappers from all classes.
>>> from apps.categories.models import *
Original issue reported on code.google.com by mtr...@gmail.com on 9 Apr 2008 at 11:32
Original issue reported on code.google.com by
mtr...@gmail.com
on 9 Apr 2008 at 11:32