I think he means that if you only need an exact match on your query (instead
of a 'like' or a '' etc) you can do this:
dict_from_web = {'Title':'The Book','Author':'Bob Smith'}
for b in session.query(Book).filter_by(**dict_from_web)
will return the books that have the exact Title 'The Book'
Mark, yes, in part. What I cannot figure out -- and am not sure this
is possible with SQLAlchemy, is to go from strings, as returned from
HTTP Post's, representing the fields in the table (for the left side
of the relation) to the actual statemetn itself. In other words, if
the HTTP post calls for
say you want to filter on the 'field' (field would be a string representing
the name of the field) on objects of class == Klass
field_attr = getattr(Klass, field)
would give you the instrumented attribute
then
Session.query(Klass).filter(field_attr == searchString)
or
On Aug 12, 2011, at 11:52 AM, NiL wrote:
say you want to filter on the 'field' (field would be a string representing
the name of the field) on objects of class == Klass
field_attr = getattr(Klass, field)
would give you the instrumented attribute
then
On 08/12/2011 05:52 PM, NiL wrote:
say you want to filter on the 'field' (field would be a string
representing the name of the field) on objects of class == Klass
field_attr = getattr(Klass, field)
would give you the instrumented attribute
then
Session.query(Klass).filter(field_attr ==
Wickert, can you give me an example ? I'm a little confused by this
posts of yours. RVince
On Aug 12, 12:20 pm, Wichert Akkerman wich...@wiggy.net wrote:
On 08/12/2011 05:52 PM, NiL wrote:
say you want to filter on the 'field' (field would be a string
representing the name of the field)
Thanks to all you guys. Really. I didn't think I would be able to do
this! RVince
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to