实施该更改后,我没有收到 Numpy 错误,而是格式错误。所以做了下面的改动
filename = 'test.csv'division = test.iloc[0][4]division_tuple = tuple(map(int, str(division).split(",")))sql = cs.execute("""INSERT INTO sample_table_nameselect c.customer_id,c.customer_namefrom(t.customer_idt.customer_namefrom customer_table twhere division_id in (%s) --changed format here group by 1,2) c ;""",(division_tuple)) #and here
虽然这在技术上会使 where 子句在只有一个值时看起来像
“where Division_id in (92,)”,但这仍然是运行它的正确方法,尽管在 92 之后有尾随逗号。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)