我有这种奇怪的行为
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)
请帮帮我
我不是sqlalchemy专家,但这是不是因为每次循环都要覆盖和参数?你知道吗
是这样的吗
你有本事吗?你知道吗
谢谢你
我设法做到了:
相关问题 更多 >
编程相关推荐