Re: [sqlalchemy] Performing filter by using string

2017-03-22 Thread mike bayer
keeping in mind it's absolutely not safe to do this with *untrusted* user input, you'd use exec/eval: globals_ = globals() locals_ = {} exec("%s = map_model" % model, globals_, locals_) q = session.query(model).filter(eval(condition, globals_, locals_)) On 03/22/2017 10:00 AM, Vijaya Sekar

[sqlalchemy] Performing filter by using string

2017-03-22 Thread Vijaya Sekar
Hi everyone, I have an string which has the condition to be performed while retrieving from database. I automap my model and make reference to it by using another variable name. How can achieve retrieve data by filter which is in string? here is my code from sqlalchemy import create_engine fro