SQLAlchemy - Getting a list of tables

前端 未结 9 1050
青春惊慌失措
青春惊慌失措 2020-12-08 03:40

I couldn\'t find any information about this in the documentation, but how can I get a list of tables created in SQLAlchemy?

I used the class method to create the tab

9条回答
  •  时光说笑
    2020-12-08 04:03

    Just this simple:

    engine.table_names()
    

    Also, to test whether a table exists:

    engine.has_table(table_name)
    

提交回复
热议问题