How to get column names from SQLAlchemy result (declarative syntax)

后端 未结 7 743
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-01 01:26

I am working in a pyramid project and I\'ve the table in SQLAlchemy in declarative syntax

\"\"\"models.py\"\"\"
class Projects(Base):
    __tablename__ = \'proje         


        
7条回答
  •  爱一瞬间的悲伤
    2021-02-01 01:50

    You can do something similar to Foo Stack's answer without resorting to private fields by doing:

    conn.execute(query).keys()
    

提交回复
热议问题