是否可以使用sqlalchemy列出数据库中的所有索引?
答案 0 :(得分:3)
from sqlalchemy import create_engine
from sqlalchemy.engine import reflection
engine = create_engine('...')
insp = reflection.Inspector.from_engine(engine)
for name in insp.get_table_names():
for index in insp.get_indexes(name):
print index