summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2021-09-24 11:32:46 +0100
committerStephen Finucane <stephenfin@redhat.com>2021-09-24 12:08:47 +0100
commit8360df736d377d02cb7f22e6c32c10295476086b (patch)
tree7bd0e04c66b0e89fab389ec3c25ae49e20894eee
parentd7742015f732625ff0c3e455ac5e1c01ba3d9a45 (diff)
downloadoslo-db-8360df736d377d02cb7f22e6c32c10295476086b.tar.gz
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 <stephenfin@redhat.com>
-rw-r--r--oslo_db/sqlalchemy/provision.py3
1 files changed, 1 insertions, 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(