我有以下声明:
from alembic import op
conn = op.get_bind()
现在我想获取postgresql版本。
最佳答案
根据文档,它是 server_version连接属性:
conn = psycopg2.connect(settings.DB_DSN)
>>> conn.server_version
90504
The number is formed by converting the major, minor, and revision numbers into two-decimal-digit numbers and appending them together. For example, version 8.1.5 will be returned as 80105.
关于postgresql - 如何使用 psycopg2 获取 PostgreSQL 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39447836/