Merge "Fix sqlalchemy table_names DeprecationWarning"
This commit is contained in:
@@ -21,7 +21,7 @@ from oslo_db import exception as oslo_db_exception
|
||||
from oslo_db.sqlalchemy import utils as oslodb_utils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
from sqlalchemy import select, or_, between, func, distinct
|
||||
from sqlalchemy import select, or_, between, func, distinct, inspect
|
||||
|
||||
from designate import exceptions
|
||||
from designate import objects
|
||||
@@ -96,6 +96,9 @@ class SQLAlchemy(object, metaclass=abc.ABCMeta):
|
||||
def rollback(self):
|
||||
self.session.rollback()
|
||||
|
||||
def get_inspector(self):
|
||||
return inspect(self.engine)
|
||||
|
||||
@staticmethod
|
||||
def _apply_criterion(table, query, criterion):
|
||||
if criterion is not None:
|
||||
|
||||
@@ -53,7 +53,8 @@ class SqlalchemyStorageTest(StorageTestCase, TestCase):
|
||||
u'zone_transfer_requests',
|
||||
u'zones'
|
||||
]
|
||||
self.assertEqual(table_names, self.storage.engine.table_names())
|
||||
inspector = self.storage.get_inspector()
|
||||
self.assertEqual(table_names, inspector.get_table_names())
|
||||
|
||||
def test_schema_table_indexes(self):
|
||||
indexes_t = self.storage.engine.execute("SELECT * FROM sqlite_master WHERE type = 'index';") # noqa
|
||||
|
||||
Reference in New Issue
Block a user