Cool :-)

When's 0.9 due for release?

Chris

On 29/11/2013 20:17, Michael Bayer wrote:
here you go, give it a spin:

http://docs.sqlalchemy.org/en/rel_0_9/changelog/migration_09.html#new-text-capabilities



On Nov 29, 2013, at 12:13 PM, Michael Bayer <[email protected]> wrote:

here’s a patch:

http://www.sqlalchemy.org/trac/ticket/2877

it’s quite short.   I just don’t like the current contract of SelectBase, which 
has many methods that don’t apply here, so might want to rework the base 
classes.




On Nov 22, 2013, at 5:06 AM, Chris Withers <[email protected]> wrote:

On 21/11/2013 19:25, Michael Bayer wrote:

hoping you’ve already figured it out but otherwise I’m not entirely following 
what the larger query you’re looking for would look like.    I doubt you need 
text() for anything.

Okay, pseudo code that doesn't work:

positions = something("""
select instrument_id, sum(quantity) as quantity
       from transaction where
           account_id = :account_id and
           timestamp < :dt and
       group by instrument_id
       having sum(quantity) != 0
""", dict(dt=date(2013, 1, 1), account_id='foo')).cte('positions')

print session.query(Instrument, positions.c.quantity)\
      .select_from(Instrument)\
      .join(positions, Instrument.id=positions.instrument_id)\
      .all()

(this latter query will likely have more stuff in it, not sure I used 
.select_from(...).join(...) correctly either ;-)

Hope that illustrates what I'm after...

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
           - http://www.simplistix.co.uk

--
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/groups/opt_out.



--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

--
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/groups/opt_out.

Reply via email to