suppress echo of INSERT/UPDATE large binary data

28 views
Skip to first unread message

Kent

unread,
Aug 17, 2016, 1:25:17 PM8/17/16
to sqlalchemy
Generally, echo=True for log level of INFO is very helpful for log files.

But on INSERT/UPDATE of a Binary column (at least with Oracle, BLOB) it sure would be nice to skip the logging of the sometimes massive binary data.

Is this possible?

Thanks,
Kent

Jonathan Vanasco

unread,
Aug 17, 2016, 5:30:25 PM8/17/16
to sqlalchemy


On Wednesday, August 17, 2016 at 1:25:17 PM UTC-4, Kent wrote:
Generally, echo=True for log level of INFO is very helpful for log files.

If you just have a few of these, you can wrap the flush:

dbSession.add(bigObject)
try:
    # wrap `flush` in a disabled block, so we don't go crazy with logging
    logging.getLogger('sqlalchemy.engine.base.Engine').disabled = True
    dbSession.flush()
except:
    raise
finally:
    logging.getLogger('sqlalchemy.engine.base.Engine').disabled = False

If you have a lot, I believe you can use the event listening system to do something similar.

Mike Bayer

unread,
Aug 17, 2016, 5:41:59 PM8/17/16
to sqlal...@googlegroups.com
http://docs.sqlalchemy.org/en/latest/changelog/migration_11.html#large-parameter-and-row-values-are-now-truncated-in-logging-and-exception-displays

until you can upgrade write a logging output filter...



>
> Thanks,
> Kent
>
> --
> You received this message because you are subscribed to the Google
> Groups "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sqlalchemy+...@googlegroups.com
> <mailto:sqlalchemy+...@googlegroups.com>.
> To post to this group, send email to sqlal...@googlegroups.com
> <mailto:sqlal...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

Kent Bower

unread,
Aug 18, 2016, 9:39:35 AM8/18/16
to sqlal...@googlegroups.com
I attempted to search for such an enhancement but obviously failed to find it.   Patching the changeset in was fairly straightforward.

Thanks very much Jonathan and Mike!!



On Wed, Aug 17, 2016 at 5:41 PM, Mike Bayer <mik...@zzzcomputing.com> wrote:


On 08/17/2016 01:25 PM, Kent wrote:
Generally, echo=True for log level of INFO is very helpful for log files.

But on INSERT/UPDATE of a Binary column (at least with Oracle, BLOB) it
sure would be nice to skip the logging of the sometimes massive binary data.

Is this possible?

http://docs.sqlalchemy.org/en/latest/changelog/migration_11.html#large-parameter-and-row-values-are-now-truncated-in-logging-and-exception-displays

until you can upgrade write a logging output filter...




Thanks,
Kent

--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send

To post to this group, send email to sqlal...@googlegroups.com

--
You received this message because you are subscribed to a topic in the Google Groups "sqlalchemy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy/gA3Q4DQWLKw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sqlalchemy+unsubscribe@googlegroups.com.
To post to this group, send email to sqlal...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages