One thing I like to do is grab the logger and just log my own line around 
the query:

logger = logging.getLogger('sqlalchemy.engine')
logger.info('========== ABOUT TO RUN MY QUERY ==========')
# run your query
logger.info('========== DONE RUNNING QUERY ==========')

and then I grep the logs for "ABOUT TO RUN MY QUERY" instead. Doesn't 
answer your question of writing to a single line, but makes it easier to 
find at least.

On Tuesday, April 22, 2014 1:29:41 PM UTC-7, Michael Bayer wrote:
>
> you can perhaps use a logging filter,  just split the logs on a different 
> token other than the newline, or write your own log routine using the 
> before_cursor_execute event.  there’s a lot of ways to get this effect but 
> none are more convenient than another.
>
>
> On Apr 22, 2014, at 10:49 AM, lev katzav <[email protected] <javascript:>> 
> wrote:
>
> Hi all,
>
> I am execution a complicated query,
> and when the query is written to the log, it breaks down into separate 
> lines.
>
> This makes it really difficult to search the resulting log file for a 
> query,
> since grep will find only part of the query.
>
> Is there a way to force the query to be written in a single line?
>
> Thanks,
> Lev.
>
> -- 
> 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 [email protected] <javascript:>.
> To post to this group, send email to [email protected]<javascript:>
> .
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to