You can build your SQLAlchemy queries dynamically, i.e.
q1 = query.Session.query(table).filter(A == B)
q2 = q1.filter(C == D)
q3 = q2.filter(E == F)
you could apply different relationships using conditional Python statements:
if rel == 'eq':
q4 = q3.filter(G == H)
elif rel == 'neq':
q4 = q3.filter(G != H)
is this what you're looking for?
Mark
You can also use the class's __dict__ member:
field_attr = Klass.__dict__['field']
It really amazes me how Pythonic SQLAlchemy makes database access.
Mark
Alternatively if you are only interested in equality you can skip the
getattr and use filter_by in combination with python's keyword argument
handling:
Session.query(klass).filter_by(**{field: value})
Wichert.