On 03/02/2016 04:59 PM, Brian Cherinka wrote:
Thanks, Mike.  This is excellent.  That did the trick.  That's much
easier than what I was trying to do.   Do you know if there is a way to
auto bindparam every parameter I have in my Declarative Bases, if and
when they get added into a filter?  Basically, I need to allow the user
to be able to modify any parameter they set after the fact, but I have a
crazy amount of parameters to explicitly do this for.

well you need a list of names so from a mapped class you can get:

for name in inspect(MyClass).column_attrs.keys():
   if name in <whatever my filter thing is>:
       q = q.filter_by(name = bindparam(name))

though I'd think if you're dynamically building the query you'd have the values already, not sure how it's working out that you need bindparam() at that stage...







Cheers, Brian

On Wednesday, March 2, 2016 at 4:28:46 PM UTC-5, Mike Bayer wrote:




--
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 sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to