Conditionally import ibmdb2/ibm_db_sa
Since ibm_db_sa is not part of sqlalchemy, we need to handle the conditional import of the module in visitor.py so we don't get an ImportError if ibm_db_sa is not available. Closes-Bug: #1287229 Change-Id: Ida070b629ce3b9be727ae49973bb6a71543c1dcf
This commit is contained in:
parent
21fcdad0f4
commit
12a6bcfa8c
@ -8,8 +8,7 @@ from migrate.changeset.databases import (sqlite,
|
|||||||
postgres,
|
postgres,
|
||||||
mysql,
|
mysql,
|
||||||
oracle,
|
oracle,
|
||||||
firebird,
|
firebird)
|
||||||
ibmdb2)
|
|
||||||
|
|
||||||
|
|
||||||
# Map SA dialects to the corresponding Migrate extensions
|
# Map SA dialects to the corresponding Migrate extensions
|
||||||
@ -21,10 +20,19 @@ DIALECTS = {
|
|||||||
"mysql": mysql.MySQLDialect,
|
"mysql": mysql.MySQLDialect,
|
||||||
"oracle": oracle.OracleDialect,
|
"oracle": oracle.OracleDialect,
|
||||||
"firebird": firebird.FBDialect,
|
"firebird": firebird.FBDialect,
|
||||||
"ibm_db_sa": ibmdb2.IBMDBDialect
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# NOTE(mriedem): We have to conditionally check for DB2 in case ibm_db_sa
|
||||||
|
# isn't available since ibm_db_sa is not packaged in sqlalchemy like the
|
||||||
|
# other dialects.
|
||||||
|
try:
|
||||||
|
from migrate.changeset.databases import ibmdb2
|
||||||
|
DIALECTS["ibm_db_sa"] = ibmdb2.IBMDBDialect
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def get_engine_visitor(engine, name):
|
def get_engine_visitor(engine, name):
|
||||||
"""
|
"""
|
||||||
Get the visitor implementation for the given database engine.
|
Get the visitor implementation for the given database engine.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user