for key in request.args:
    if hasattr(MyModel, key):
        vals = request.args.getlist(key)
builder = builder.filter(getattr(MyModel, key).in_(vals))
if not 'page' in request.args:
    pass
flask sqlalchemy query with keyword as variable