[sqlalchemy] timing queries ?

2013-09-17 Thread Jonathan Vanasco
is there a currently recommended approach ? looking through the backcatalog of qa (from 2008-2010) , it seems like the options are: - manually look at debug data , subtract timestamps for a general idea - write something with ConnectionEvents ( originally ConnectionProxy ) for now, i just want

Re: [sqlalchemy] timing queries ?

2013-09-17 Thread Jonathan Vanasco
it might be better for the recipe to be: logger = logging.getLogger(sqlalchemy.engine.base.Engine) logger.setLevel(logging.INFO) logger.info(Query Complete! Total Time: %f % total) This will correlate it to the existing sql statement logging ( which is a way more natural place

Re: [sqlalchemy] timing queries ?

2013-09-17 Thread Jonathan Vanasco
On Tuesday, September 17, 2013 3:59:31 PM UTC-4, Michael Bayer wrote: there's a modern recipe at: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Profiling but yeah, thats ConnectionEvents. what's the issue there, you need how long result fetching takes ? thanks! yeah. Some of the

Re: [sqlalchemy] timing queries ?

2013-09-17 Thread Michael Bayer
there's a modern recipe at: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Profiling but yeah, thats ConnectionEvents. what's the issue there, you need how long result fetching takes ? On Sep 17, 2013, at 2:28 PM, Jonathan Vanasco jonat...@findmeon.com wrote: is there a currently

[sqlalchemy] Dialect dependent REPLACEs

2013-09-17 Thread Samer Atiani
Hello, I'm trying to write a custom REPLACE expression that compiles differently on MySQL vs sqlite, namely it would look like REPLACE INTO in mysql and INSERT OR REPLACE in sqlite. I implemented it like so: class ReplaceInto(ValuesBase): def __init__(self, table, values=None):

[sqlalchemy] using WITH query AS, cte() with postgresql

2013-09-17 Thread Nathan Mailg
I'm using SA 0.8.2 and trying to port this query that works with PostgreSQL 9.2.4: WITH distinct_query AS ( SELECT DISTINCT ON (refid) * FROM appl WHERE lastname ILIKE 'Williamson%' AND firstname ILIKE 'd%' GROUP BY refid, id, lastname, firstname, appldate

Re: [sqlalchemy] using WITH query AS, cte() with postgresql

2013-09-17 Thread Michael Bayer
here's a proof of concept which completes in postgresql for me: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Appl(Base): __tablename__ = 'appl' id = Column(Integer, primary_key=True)