未验证 提交 bcc080a7 编写于 作者: 😸 😸

use `postgresql` instead of `postgres` (deprecated in SQLAlchemy)

上级 8d652225
......@@ -1185,13 +1185,13 @@ def show_config(command):
connstr = "postgresql://service=%s" % cnf["DB::Service"]
elif "DB::Host" in cnf:
# TCP/IP
connstr = "postgres://%s" % cnf["DB::Host"]
connstr = "postgresql://%s" % cnf["DB::Host"]
if "DB::Port" in cnf and cnf["DB::Port"] != "-1":
connstr += ":%s" % cnf["DB::Port"]
connstr += "/%s" % cnf["DB::Name"]
else:
# Unix Socket
connstr = "postgres:///%s" % cnf["DB::Name"]
connstr = "postgresql:///%s" % cnf["DB::Name"]
if cnf["DB::Port"] and cnf["DB::Port"] != "-1":
connstr += "?port=%s" % cnf["DB::Port"]
print(connstr)
......
......@@ -70,9 +70,6 @@ from .config import Config
from .textutils import fix_maintainer, force_to_utf8
# suppress some deprecation warnings in squeeze related to sqlalchemy
warnings.filterwarnings('ignore',
"The SQLAlchemy PostgreSQL dialect has been renamed from 'postgres' to 'postgresql'.*",
SADeprecationWarning)
warnings.filterwarnings('ignore',
"Predicate of partial index .* ignored during reflection",
SAWarning)
......@@ -96,8 +93,8 @@ class DebVersion(sqlalchemy.types.UserDefinedType):
return None
from sqlalchemy.databases import postgres
postgres.ischema_names['debversion'] = DebVersion
from sqlalchemy.databases import postgresql
postgresql.ischema_names['debversion'] = DebVersion
################################################################################
......
......@@ -38,13 +38,13 @@ class DBDakTestCase(DakTestCase):
cnf["DB::Name"])
if cnf["DB::Host"]:
# TCP/IP
connstr = "postgres://%s" % cnf["DB::Host"]
connstr = "postgresql://%s" % cnf["DB::Host"]
if cnf["DB::Port"] and cnf["DB::Port"] != "-1":
connstr += ":%s" % cnf["DB::Port"]
connstr += "/%s" % cnf["DB::Name"]
else:
# Unix Socket
connstr = "postgres:///%s" % cnf["DB::Name"]
connstr = "postgresql:///%s" % cnf["DB::Name"]
if cnf["DB::Port"] and cnf["DB::Port"] != "-1":
connstr += "?port=%s" % cnf["DB::Port"]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册