我得到了这种奇怪的行为
test_dict = {'productDue' : ['foo'],'releaseDue' : ['bar']}
for attr, value in test_dict.items() :
print attr
and_args = [(and_(getattr(my_table,attr).in_(value)))]
这给了我:
>>> print and_(*and_args)
"my_table"."releaseDue" IN (:releaseDue_1)
然后当我切换顺序时:
test_dict = {'releaseDue' : ['bar'],'productDue' : ['foo']}
for attr, value in test_dict.items() :
print attr
and_args = [(and_(getattr(my_table,attr).in_(value)))]
我得到:
>>> print and_(*and_args)
"TDC"."releaseDue" IN (:releaseDue_1)
没看懂,想拥有"TDC"."releaseDue" IN (:releaseDue_1) AND "TDC"."productDue" IN (:productDue_1)
请帮忙