次のSQLAlchemyマップクラスがあります。
class User(Base):__tablename__ = "users" email = Column(String、primary_key = True)name = Column(String)class Document (ベース):__ tablename__ = "documents" name = Column(String、primary_key = True)author = Column(String、ForeignKey( "users.email"))class DocumentsPermissions(Base):__tablename__ = "documents_permissions" readAllowed = Column(Boolean )writeAllowed = Column(Boolean)document = Column(String、ForeignKey( "documents.name"))
user.email="のようなテーブルを取得する必要があります[email protected] "
:
email |名前| document_name | document_readAllowed | document_writeAllowed
SQLAlchemyの1つのクエリリクエストを使用してどのように作成できますか?以下のコードは私には機能しません:
result = session.query(User、Document、DocumentPermission).filter_by(email = "[email protected]")。all()
ありがとうございます