How to print all columns in SQLAlchemy ORM

后端 未结 10 2009
再見小時候
再見小時候 2020-12-28 15:18

Using SQLAlchemy, I am trying to print out all of the attributes of each model that I have in a manner similar to:

SELECT * from table;

How

10条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 15:39

    print repr(model.__table__)
    

    Or just the columns:

    print str(list(model.__table__.columns))
    

提交回复
热议问题