From 8360df736d377d02cb7f22e6c32c10295476086b Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 24 Sep 2021 11:32:46 +0100 Subject: [PATCH] Configure driver for postgres Avoid the following warning seen in e.g. nova unit tests: WARNING oslo_db.sqlalchemy.engines [-] URL postgresql://.../foo does not contain a '+drivername' portion, and will make use of a default driver. A full dbname+drivername:// protocol is recommended. The 'psycopg2' driver is chosen since this is the default for SQLAlchemy [1] and therefore what we're currently using. [1] https://docs.sqlalchemy.org/en/14/core/engines.html#postgresql Change-Id: I0f8f358a49a83366d7dec17e7bac346453f3027b Signed-off-by: Stephen Finucane --- oslo_db/sqlalchemy/provision.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/oslo_db/sqlalchemy/provision.py b/oslo_db/sqlalchemy/provision.py index f891862..edb2f95 100644 --- a/oslo_db/sqlalchemy/provision.py +++ b/oslo_db/sqlalchemy/provision.py @@ -577,8 +577,7 @@ class SQLiteBackendImpl(BackendImpl): @BackendImpl.impl.dispatch_for("postgresql") class PostgresqlBackendImpl(BackendImpl): def create_opportunistic_driver_url(self): - return "postgresql://openstack_citest:openstack_citest"\ - "@localhost/postgres" + return "postgresql+psycopg2://openstack_citest:openstack_citest@localhost/postgres" # noqa: E501 def create_named_database(self, engine, ident, conditional=False): with engine.connect().execution_options( -- GitLab