From: Josep Pascual Badia Date: Mon, 30 May 2022 10:56:02 +0000 (+0200) Subject: Update connection.rst X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e229b3cfcde4927e8b6ffb5611dd46c031a5129;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Update connection.rst Fix a bug on reconnecting logic since at it is right now it is assigning the new connection to a new cursor but is till retrying on the old one. --- diff --git a/doc/build/faq/connections.rst b/doc/build/faq/connections.rst index d592ccf6dc..59db00c37b 100644 --- a/doc/build/faq/connections.rst +++ b/doc/build/faq/connections.rst @@ -281,7 +281,7 @@ statement executions:: trans.rollback() time.sleep(retry_interval) - context.cursor = cursor_obj = connection.connection.cursor() + context.cursor = cursor = connection.connection.cursor() else: raise else: @@ -290,15 +290,15 @@ statement executions:: e = engine.execution_options(isolation_level="AUTOCOMMIT") @event.listens_for(e, "do_execute_no_params") - def do_execute_no_params(cursor_obj, statement, context): + def do_execute_no_params(cursor, statement, context): return _run_with_retries( - context.dialect.do_execute_no_params, context, cursor_obj, statement + context.dialect.do_execute_no_params, context, cursor, statement ) @event.listens_for(e, "do_execute") - def do_execute(cursor_obj, statement, parameters, context): + def do_execute(cursor, statement, parameters, context): return _run_with_retries( - context.dialect.do_execute, context, cursor_obj, statement, parameters + context.dialect.do_execute, context, cursor, statement, parameters ) return e