Hi, all.  I'm trying to built queries that handle the presence of certain
database-dependent functions like this:

# --------------------------------
q = session.query(MyTable)

if isCustomQuery:
    q = q.filter(func.custom_function(MyTable.distance > 0))

try:
    results = q.all()
except OperationalError:
    #database doesn't have "custom_function"
    remove func.custom_function filter here
    do something else
    results = q.all()

# --------------------------------

How do I remove filters that, for whatever reason, don't work?  Am I going
about this the wrong way?  I'd also be happy with a way to test whether or
not func.custom_function will compile, but I haven't found an answer to
either of these options in my searching.

Thanks in advance for your help!

-jkmacc

-- 
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.

Reply via email to