How to print all columns in SQLAlchemy ORM

后端 未结 10 2037
再見小時候
再見小時候 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:22

    Take a look at SQLAchemy's metadata reflection feature.

    A Table object can be instructed to load information about itself from the corresponding database schema object already existing within the database. This process is called reflection.

提交回复
热议问题