Show More
@@ -353,6 +353,8 b' def ping_connection(connection, branch):' | |||||
353 | def engine_from_config(configuration, prefix='sqlalchemy.', **kwargs): |
|
353 | def engine_from_config(configuration, prefix='sqlalchemy.', **kwargs): | |
354 | """Custom engine_from_config functions.""" |
|
354 | """Custom engine_from_config functions.""" | |
355 | log = logging.getLogger('sqlalchemy.engine') |
|
355 | log = logging.getLogger('sqlalchemy.engine') | |
|
356 | _ping_connection = configuration.pop('sqlalchemy.db1.ping_connection', None) | |||
|
357 | ||||
356 | engine = sqlalchemy.engine_from_config(configuration, prefix, **kwargs) |
|
358 | engine = sqlalchemy.engine_from_config(configuration, prefix, **kwargs) | |
357 |
|
359 | |||
358 | def color_sql(sql): |
|
360 | def color_sql(sql): | |
@@ -360,7 +362,6 b' def engine_from_config(configuration, pr' | |||||
360 | normal = '\x1b[0m' |
|
362 | normal = '\x1b[0m' | |
361 | return ''.join([color_seq, sql, normal]) |
|
363 | return ''.join([color_seq, sql, normal]) | |
362 |
|
364 | |||
363 | _ping_connection = configuration.get('sqlalchemy.db1.ping_connection') |
|
|||
364 | if configuration['debug'] or _ping_connection: |
|
365 | if configuration['debug'] or _ping_connection: | |
365 | sqlalchemy.event.listen(engine, "engine_connect", ping_connection) |
|
366 | sqlalchemy.event.listen(engine, "engine_connect", ping_connection) | |
366 |
|
367 |
General Comments 0
You need to be logged in to leave comments.
Login now