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

后端 未结 7 607
佛祖请我去吃肉
佛祖请我去吃肉 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:48

    Just playing around, this syntax will give you all the columns (so to solve your problem, set query to look at one table/object only):

    conn.execute(query)._metadata.keys
    

提交回复
热议问题