a = 23
b = 45
c = 67
query_result = User.query.filter(User.id == a, User.group == b, User.key == c).all()
query_result = User.query.filter(User.group == b, User.key == c).all()
from sqlalchemy import or_
query_result = User.query.filter(or_(a == None, User.id == a),
or_(b == None, User.group == b),
or_(c == None, User.key == c))
query_result = User.query
if a not None:
query_result = query_result.filter(User.id == a)
if b not None:
query_result = query_result.filter(User.group == b)
if c not None:
query_result = query_result.filter(User.key == c)
query_result = query_result.all()