Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 Python 的 DB API 列出数据库的表?
如果做不到这一点,还有其他方法吗?
谢谢
DBAPI 没有此功能,因此很遗憾您需要使用特定于数据库引擎的 SQL(没有列出表的标准化方法)。
SHOW TABLES
SELECT tablename FROM pg_tables WHERE schemaname = 'public'
SELECT name FROM sqlite_master WHERE type = 'table'
SELECT Distinct TABLE_NAME FROM information_schema.TABLES
SELECT table_name FROM all_tables
SELECT table_name FROM tables