I do not understand why I would want to share a declarative_base() between
packages. I think there has just been some confusion between the idea of
sharing a session (useful) with the idea of sharing a declarative_base()
(problematic). The following setup, each class having its own
declarative_base(), works great and it gives you predictable
Base.metadata.create_all(connection) behavior in each of your unrelated,
may-not-have-imported-each-other-yet packages.
class A(declarative_base()): __tablename__ = 'a' a_id = Column(Integer,
primary_key=True)
class B(declarative_base()): __tablename__ = 'b'
b_id = Column(Integer, primary_key=True)
a_id = Column(Integer, ForeignKey(A.a_id))
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/pylons-discuss/-/prHLL_p59QAJ.
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/pylons-discuss?hl=en.