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
I'm solving same problem and found this post. After some try run, I would suggest use below to list all tables: (mentioned by zerocog)
metadata = MetaData()
metadata.reflect(bind=engine)
for table in metadata.sorted_tables:
print(table)
This is useful for direct table handling and I feel is recommended.
And use below code to get table names:
for table_name in engine.table_names():
print(table_name)
"metadata.tables" provides a Dict for table name and Table object. which would also be useful for quick query.