Is it necessary for two SQLAlchemy models to inherit from the same instance of declarative_base()
if they must participate in the same Session? This is likely to be the case when importing two or more modules that define SQLAlchemy models.
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class SomeClass(Base):
__tablename__ = 'some_table'
id = Column(Integer, primary_key=True)
name = Column(String(50))
Base2 = declarative_base()
class AnotherClass(Base2):
__tablename__ = 'another_table'
id = Column(Integer, primary_key=True)
name = Column(String(50))