Commit 8360df73 authored by Stephen Finucane's avatar Stephen Finucane
Browse files

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: default avatarStephen Finucane <stephenfin@redhat.com>
parent d7742015
......@@ -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(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment