On Wed, Apr 13, 2011 at 6:07 PM, Michael Bayer <[email protected]> wrote:
> To work around the "instance arguments being baked in", create the query like
> this:
>
> query.filter(SomeClass.somerecord ==bindparam("somerecord"))
>
> The params are then added using query.params(somerecord=x).
Is it possible to use this with .get()?
Currently, all our
...query(Item).get(id)
become
q=...query(Item).filter_by(id=bindparam('id'))
q.params(id=id).one()
We're thinking of having a custom Session and Query that override
Query.get() to build and cache the above query internally, since this
is such a frequently used construct. But we wanted to see if we're
missing anything first.
--
Yang Zhang
http://yz.mit.edu/
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.