Hi all,
I have a problem when using the versioned recipe together with
Association proxy. Some code may make this clear:
import...
class ItemKeywordAsso(Base):
__tablename__ = "item_keywords"
id = Column(Integer, primary_key=True)
item_id = Column(Integer, ForeignKey('items.id'), index=True)
keyword_id = Column(Integer, ForeignKey('keywords.id'), index=True)
item = relationship("Item", backref="item_keywords")
keyword = relationship("Keyword", lazy="joined")
def __init__(self, item=None, keyword=None):
self.item = item
self.keyword = keyword
class Item(Base, InnodbTableMixin):
__metaclass__ = VersionedMeta
__tablename__ = 'items'
id = Column(Integer, primary_key=True)
name = Column(Unicode(255))
description = Column(UnicodeText)
keywords = association_proxy("item_keywords", "keyword",
creator=lambda k: \
ItemKeywordAsso(keyword=k))
The Error produced:
ERROR: Failure: InvalidRequestError (Table 'item_keywords' is already
defined for this MetaData instance. Specify 'extend_existing=True' to
redefine options and columns on an existing Table object.)
However: If i remove the "__metaclass__= VersionedMeta" in the Item
class, everything works normally.
Has anyone come across this? Any suggestions?
Regards,
Eric.
--
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.