Michael Bayer wrote:
Piecing together a select() construct and compiling to a string is a
relatively inexpensive operation.The vast majority of time in Query is
spent about 1/3rd-half on the database side and the rest in fetching rows
and instantiating/populating objects.
Fair enough.
Michael Bayer wrote:
Now, is there any way I can pre-cook this (eg: at module-level) such
that I can later just plug in self.id and on_date, bind to a session and
call .all() on it?
It seems a bit wasteful to do all the SQL generation on every query when
it's almost all identical all the
Chris Withers wrote:
This is a bit puzzling. Surely all the taking of python Query, select,
and_, join, etc objects, running them through dialects, etc and ending
up with a string of sql only needs to be done once; then it should just
be a case of formatting the values and plugging them into
Le mercredi 27 janvier 2010 à 12:31 -0500, Michael Bayer a écrit :
Or, we can generate the compiled() object, which contains the SQL string
as well as a lot of important metadata about the statement used when
fetching results. But this is not possible without access to a dialect
and
Antoine Pitrou wrote:
Le mercredi 27 janvier 2010 à 12:31 -0500, Michael Bayer a écrit :
Or, we can generate the compiled() object, which contains the SQL string
as well as a lot of important metadata about the statement used when
fetching results. But this is not possible without access to
Antoine Pitrou wrote:
Le mercredi 27 janvier 2010 à 12:31 -0500, Michael Bayer a écrit :
Or, we can generate the compiled() object, which contains the SQL string
as well as a lot of important metadata about the statement used when
fetching results. But this is not possible without access to
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Chris Withers
Sent: 26 January 2010 09:13
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] any way to pre cook a monster query?
Hi All,
I have a few monster queries like
King Simon-NFHD78 wrote:
I think you can use bind parameter objects for this:
http://www.sqlalchemy.org/docs/sqlexpression.html#bind-parameter-objects
...and use the query's params method to supply the values.
Indeed, it gives an inkling...
...but how do I wire building the existing query,
Wichert Akkerman wrote:
snip offlist conversation
...but not without using session.Query or any joins, but the looks of
it...
unless I'm missing something?
There is no difference between using session.Query or not. Bindparam
just insert a dummy in a query, which you fill in when you call
Wichert Akkerman wrote:
I think you need something like this:
from sqlalchemy import sql
query = sql.select([X.a,Y.b,Z.c).join(X,Y,Z)],
X.a==sql.bindparam(a))
I'm not sure this is valid, can anyone tell me what would be the alid
form of the above?
cheers,
Chris
--
Chris Withers wrote:
Hi All,
I have a few monster queries like this:
query = session.query(
Blah1.name.label('blah1'),
Blah2.name.label('blah2'),
blah3.name.label('blah4'),
Blah5.name.label('blah5'),
Blah6.name.label('blah6'),
11 matches
Mail list logo