Skip to content

arbitrarily truncate SQL log messages ? allow some option ? #2243

Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot
Collaborator

Migrated issue, originally created by Anonymous

I like SQLAlchemy's logging integration, but when the logged data would be huge (say I'm issuing a 15000-line INSERT statement), SQLAlchemy should recognize that and truncate logged information to a reasonable maximum (say 1000 characters). Otherwise I'm forced to disable logging.


Attachments: 2243.patch

Activity

sqlalchemy-bot

sqlalchemy-bot commented on Aug 3, 2011

@sqlalchemy-bot
CollaboratorAuthor

Anonymous wrote:

Ah, I forgot to add my e-mail address as cc: solipsis@pitrou.net. Sorry.

sqlalchemy-bot

sqlalchemy-bot commented on Aug 3, 2011

@sqlalchemy-bot
CollaboratorAuthor

Anonymous wrote:

Sorry again :) It's solipsis at pitrou dot net.

sqlalchemy-bot

sqlalchemy-bot commented on Aug 3, 2011

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

Arbitrarily/implicitly truncating a generated SQL statement in the log sounds awfully unreasonable to me. I'm looking at a SQL statement right in my terminal right now that's 3195 characters, and I need every single one of them to paste into my command line tool for testing.

This use case can be handled easily within the Python logging module itself using a custom handler so for the moment I'm -1 on this as a SQLAlchemy behavior and -10 as an automatic behavior. Will forward to the development list for alternative suggestions.

sqlalchemy-bot

sqlalchemy-bot commented on Aug 3, 2011

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed title from "logging should be reasonable" to "arbitrarily truncate SQL log messages ? allow som"
  • set milestone to "0.7.xx"
sqlalchemy-bot

sqlalchemy-bot commented on Aug 3, 2011

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

Oh, you're talking about the parameter lists? That's a different story. We do truncate those in exception messages already. Can you please add some specifics here as I am open to the latter and not the former.

sqlalchemy-bot

sqlalchemy-bot commented on Aug 3, 2011

@sqlalchemy-bot
CollaboratorAuthor

Anonymous wrote:

Yes, I mean the parameter lists :)
For example executing conn.execute(sometable.insert(), some_huge_list_of_dicts).

sqlalchemy-bot

sqlalchemy-bot commented on Aug 3, 2011

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

patch is attached some tests would be nice, for both exception throw (surprised we don't have that) as well as log output

sqlalchemy-bot

sqlalchemy-bot commented on Aug 3, 2011

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed milestone from "0.7.xx" to "0.7.3"
sqlalchemy-bot

sqlalchemy-bot commented on Aug 22, 2011

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

d3c1f24

sqlalchemy-bot

sqlalchemy-bot commented on Aug 22, 2011

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
added
bugSomething isn't working
engineengines, connections, transactions, isolation levels, execution options
on Nov 27, 2018
added this to the 0.7.3 milestone on Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingengineengines, connections, transactions, isolation levels, execution options

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sqlalchemy-bot

        Issue actions

          arbitrarily truncate SQL log messages ? allow some option ? · Issue #2243 · sqlalchemy/sqlalchemy