fix logging to truncate large textual/binary values
(original reporter: jonathan) The FAQ on logging
sent me to the Engine logging docs:
I wanted to suggest this addition to the docs :
Sometimes you might want to disable existing query logging for certain statements, such as when you are inserting a BLOB or large TEXT value.
An easy way to accomplish this is to wrap your query in a pair of statements
that toggle the
disabled attribute of the logger.
In the example below, note that the logger needed to disable already-enabled
query logging is
sqlalchemy.engine.base.Engine , and not the
sqlalchemy.engine logger mentioned above.
import logging logging.getLogger('sqlalchemy.engine.base.Engine').disabled = True ... execute query ... logging.getLogger('sqlalchemy.engine.base.Engine').disabled = False