获取 postgresql 的当前索引

第一种:
有场景会去查看数据库中当前索引,可通过以下语句查询:
select last_value from related_result_id_seq;

通过 execute().fetchall() 得到的结果 res , 需要取 res【0】【0】



第二种:
from sqlalchemy import func
session.query(func.max(DB.TableName.id)).first()


posted @ 2020-09-28 14:36  bhz  阅读(446)  评论(0编辑  收藏  举报