Show More
@@ -360,6 +360,10 b' def engine_from_config(configuration, pr' | |||||
360 | normal = '\x1b[0m' |
|
360 | normal = '\x1b[0m' | |
361 | return ''.join([color_seq, sql, normal]) |
|
361 | return ''.join([color_seq, sql, normal]) | |
362 |
|
362 | |||
|
363 | _ping_connection = configuration.get('sqlalchemy.db1.ping_connection') | |||
|
364 | if configuration['debug'] or _ping_connection: | |||
|
365 | sqlalchemy.event.listen(engine, "engine_connect", ping_connection) | |||
|
366 | ||||
363 | if configuration['debug']: |
|
367 | if configuration['debug']: | |
364 | # attach events only for debug configuration |
|
368 | # attach events only for debug configuration | |
365 |
|
369 | |||
@@ -381,8 +385,6 b' def engine_from_config(configuration, pr' | |||||
381 | parameters, context, executemany): |
|
385 | parameters, context, executemany): | |
382 | delattr(conn, 'query_start_time') |
|
386 | delattr(conn, 'query_start_time') | |
383 |
|
387 | |||
384 | sqlalchemy.event.listen(engine, "engine_connect", |
|
|||
385 | ping_connection) |
|
|||
386 | sqlalchemy.event.listen(engine, "before_cursor_execute", |
|
388 | sqlalchemy.event.listen(engine, "before_cursor_execute", | |
387 | before_cursor_execute) |
|
389 | before_cursor_execute) | |
388 | sqlalchemy.event.listen(engine, "after_cursor_execute", |
|
390 | sqlalchemy.event.listen(engine, "after_cursor_execute", |
General Comments 0
You need to be logged in to leave comments.
Login now