You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Parent(Base): tablename = 'left'
id = Column(Integer, primary_key=True)
children = relationship("Child",
secondary=association_table)
class Child(Base): tablename = 'right'
id = Column(Integer, primary_key=True)
after run "gearbox setup-app", the association_table didn't create, and the same code in Application's models worked correctly.
after I study the pluaggble's code, I found in sqla/models.py:
class SQLAModelsSupport(object):
def is_model(self, model):
return inspect.isclass(model) and hasattr(model, 'tablename')
so the subclass of Base has the attribute "tablename", but a instance of Table seems not.
The text was updated successfully, but these errors were encountered:
A typical many to many relation code like this (from Sqlalchemy's documents):
association_table = Table('association', Base.metadata,
Column('left_id', Integer, ForeignKey('left.id')),
Column('right_id', Integer, ForeignKey('right.id'))
)
class Parent(Base):
tablename = 'left'
id = Column(Integer, primary_key=True)
children = relationship("Child",
secondary=association_table)
class Child(Base):
tablename = 'right'
id = Column(Integer, primary_key=True)
after run "gearbox setup-app", the association_table didn't create, and the same code in Application's models worked correctly.
after I study the pluaggble's code, I found in sqla/models.py:
class SQLAModelsSupport(object):
def is_model(self, model):
return inspect.isclass(model) and hasattr(model, 'tablename')
so the subclass of Base has the attribute "tablename", but a instance of Table seems not.
The text was updated successfully, but these errors were encountered: