diff options
author | Angus Lees <gus@inodes.org> | 2014-07-16 11:24:53 +1000 |
---|---|---|
committer | Angus Lees <gus@inodes.org> | 2014-07-22 14:22:00 +1000 |
commit | 3bf8941cca8e03e83a1f9810300f6c60f351e1ae (patch) | |
tree | 40a1c237e8d924633ee479e126fdbe3ba9fad78b /oslo | |
parent | bf4eff9ffd577c519846c98251942a3d998311e5 (diff) | |
download | oslo-db-3bf8941cca8e03e83a1f9810300f6c60f351e1ae.tar.gz |
Specify raise_on_warnings=False for mysqlconnector
mysqlconnector driver in sqlalchemy <1.0 uses the wrong default value
for raise_on_warnings. With raise_on_warnings=True, many things we
expect to be warnings become fatal (like DROP DATABASE IF EXISTS
non_existent_db).
See https://bitbucket.org/zzzeek/sqlalchemy/issue/2515 for upstream bug.
Change-Id: Ic29c9bb6c692952640e3948f5ce31290e158068f
Diffstat (limited to 'oslo')
-rw-r--r-- | oslo/db/sqlalchemy/session.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/oslo/db/sqlalchemy/session.py b/oslo/db/sqlalchemy/session.py index 13eb118..2c91b8c 100644 --- a/oslo/db/sqlalchemy/session.py +++ b/oslo/db/sqlalchemy/session.py @@ -476,6 +476,11 @@ def create_engine(sql_connection, sqlite_fk=False, mysql_sql_mode=None, engine_args['max_overflow'] = max_overflow if pool_timeout is not None: engine_args['pool_timeout'] = pool_timeout + if connection_dict.get_dialect().driver == 'mysqlconnector': + # mysqlconnector engine (<1.0) incorrectly defaults to + # raise_on_warnings=True + # https://bitbucket.org/zzzeek/sqlalchemy/issue/2515 + engine_args['connect_args'] = {'raise_on_warnings': False} engine = sqlalchemy.create_engine(sql_connection, **engine_args) |