如何使用SQLAlchemy查询(PostgreSQL)视图

时间:2015-09-25 13:52:28

标签: sqlalchemy sql-view

通常我会像这样连接/查询

class MyTable(Base):
    __tablename__ = 'mytable'
    __table_args__ = {'schema': 'tables'}

    id = Column(Integer, primary_key=True)
    salutation = Column(VARCHAR(1))

def __init__(self, salutation):
    self.salutation = salutation

def load():
    """"""
    Session = sessionmaker(bind=engine)
    session = Session()
    for i in session.query(MyTable).order_by(MyTable.id):
        entries.append(i.__dict__)
    session.close()

但我如何查询(PostgreSQL)数据库视图,没有任何密钥?

0 个答案:

没有答案