engine = create_engine("")
df = pd.read_csv('in.csv', chunksize=1000)
for chunk in df:
list= tuple(list(chunk["column2"]))
sql = "SELECT * from table where value in {};".format(list)
found = pd.read_sql(sql, engine)
found.to_csv('out.csv', mode='a', header ['column2'], index=False)
an error appeared and I'm not sure why and how to fix:
list= tuple(list(chunk["column2"]))
TypeError: 'tuple' object is not callable
list. It overrides a builtin python name and will lead to hard to find errors.tuple(list(chunk["column2"]))works and assigns its result to the namelist. On the second iterationlistis now a tuple, so the inner partlist(chunk["column2"])is calling a tuple, not the builtinlist.