summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/events.py
diff options
context:
space:
mode:
authorMike Bayer <classic@zzzcomputing.com>2014-11-26 13:40:15 -0500
committerMike Bayer <classic@zzzcomputing.com>2014-11-26 13:40:15 -0500
commitca320be944c83e8a1a5f11558eca0d35b0f51812 (patch)
treed7b03a00387ca64a591095d1df5d8da928d75f18 /lib/sqlalchemy/events.py
parentfb06fa9d6e6f6da8eee5b7dfc196c3e12761da61 (diff)
parent0f5a400b77862d2ae8f5d1a326fe9571da8fc0cb (diff)
downloadsqlalchemy-ca320be944c83e8a1a5f11558eca0d35b0f51812.tar.gz
Merged in jvanasco/sqlalchemy-alt/issue_docs_event_statement (pull request #33)
added docs to clarify that sql statement is already in a dialect
Diffstat (limited to 'lib/sqlalchemy/events.py')
-rw-r--r--lib/sqlalchemy/events.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/sqlalchemy/events.py b/lib/sqlalchemy/events.py
index b4f057b0a..c144902cd 100644
--- a/lib/sqlalchemy/events.py
+++ b/lib/sqlalchemy/events.py
@@ -420,6 +420,12 @@ class ConnectionEvents(event.Events):
context, executemany):
log.info("Received statement: %s" % statement)
+ When the methods are called with a `statement` parameter, such as in
+ :meth:`.after_cursor_execute`, :meth:`.before_cursor_execute` and
+ :meth:`.dbapi_error`, the statement is the exact SQL string that was
+ prepared for transmission to the DBAPI ``cursor`` in the connection's
+ :class:`.Dialect`.
+
The :meth:`.before_execute` and :meth:`.before_cursor_execute`
events can also be established with the ``retval=True`` flag, which
allows modification of the statement and parameters to be sent
@@ -549,9 +555,8 @@ class ConnectionEvents(event.Events):
def before_cursor_execute(self, conn, cursor, statement,
parameters, context, executemany):
"""Intercept low-level cursor execute() events before execution,
- receiving the string
- SQL statement and DBAPI-specific parameter list to be invoked
- against a cursor.
+ receiving the string SQL statement and DBAPI-specific parameter list to
+ be invoked against a cursor.
This event is a good choice for logging as well as late modifications
to the SQL string. It's less ideal for parameter modifications except
@@ -571,7 +576,7 @@ class ConnectionEvents(event.Events):
:param conn: :class:`.Connection` object
:param cursor: DBAPI cursor object
- :param statement: string SQL statement
+ :param statement: string SQL statement, as to be passed to the DBAPI
:param parameters: Dictionary, tuple, or list of parameters being
passed to the ``execute()`` or ``executemany()`` method of the
DBAPI ``cursor``. In some cases may be ``None``.
@@ -596,7 +601,7 @@ class ConnectionEvents(event.Events):
:param cursor: DBAPI cursor object. Will have results pending
if the statement was a SELECT, but these should not be consumed
as they will be needed by the :class:`.ResultProxy`.
- :param statement: string SQL statement
+ :param statement: string SQL statement, as passed to the DBAPI
:param parameters: Dictionary, tuple, or list of parameters being
passed to the ``execute()`` or ``executemany()`` method of the
DBAPI ``cursor``. In some cases may be ``None``.
@@ -640,7 +645,7 @@ class ConnectionEvents(event.Events):
:param conn: :class:`.Connection` object
:param cursor: DBAPI cursor object
- :param statement: string SQL statement
+ :param statement: string SQL statement, as passed to the DBAPI
:param parameters: Dictionary, tuple, or list of parameters being
passed to the ``execute()`` or ``executemany()`` method of the
DBAPI ``cursor``. In some cases may be ``None``.