Flask-SQLAlchemy database engine returns table names, but the table keys in metadata are empty
问题 I am connected to a MS SQL Server. The following returns all the table names in the database: app.config.from_object('config') db = SQLAlchemy(app) db.engine.table_names() However, this doesn't: db.metadata.tables.keys() // returns: dict_keys([]) Similarly, this doesn't work: db.table('dbo.users').primary_key // returns: ColumnSet([]) However, I am able to execute SQL queries. What would be the problem? 回答1: Engine.table_names gives you a list of available table names from the database.