From bcc080a7cb02aad88647898f366a0811dda70ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=98=B8?= <😸@43-1.org> Date: Sat, 19 Sep 2020 07:34:16 +0200 Subject: [PATCH] use `postgresql` instead of `postgres` (deprecated in SQLAlchemy) --- dak/admin.py | 4 ++-- daklib/dbconn.py | 7 ++----- tests/db_test.py | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/dak/admin.py b/dak/admin.py index 96943cdb..df75738a 100644 --- a/dak/admin.py +++ b/dak/admin.py @@ -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) diff --git a/daklib/dbconn.py b/daklib/dbconn.py index ec8d7de2..2f4a68bd 100644 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -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 ################################################################################ diff --git a/tests/db_test.py b/tests/db_test.py index 08c66b8a..74de575c 100644 --- a/tests/db_test.py +++ b/tests/db_test.py @@ -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"] -- GitLab