Pastebin
Paste #2880: No description
< previous paste - next paste>
Pasted by Anonymous Coward
offsets = {
"mm_foot_length" : (8,10),
"mm_forefoot_width" : (3,5),
"mm_forefoot_height" : (2,3),
"mm_instep_height" : (2,3),
"mm_heel_width" : (2,3)
}
and_=sqlalchemy.sql.expression.and_
query = sesseion.query(Footwear).filter(
and_(
*list(
and_(
getattr(Footwear,k) >= v + offsets[k][0],
getattr(Footwear,k) <= v + offsets[k][1]
)
) for k, v in criteria.values()
)
)
print query
New Paste
Go to most recent paste.