falconframework

Python SqlAlchemy - AttributeError: mapper

寵の児 提交于 2019-12-02 13:33:13
based on my model: from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy.orm import relationship Base = declarative_base() class Session(Base): __tablename__ = 'sessions' id = Column(Integer, primary_key=True) token = Column(String(200)) user_id = Column(Integer, ForeignKey('app_users.id')) user = relationship('model.user.User', back_populates='sessions') I want to instantiate a new session through: session = Session(token='test-token-123') But i get: AttributeError: mapper The full stacktrace: Traceback (most recent