I'm trying to pass multiple tuple to placeholders in SQLite. Example I got 2 tuple like below:
tup_A = (1, 2, 3, 4)
tup_B = (5, 6, 7, 8)
The SQL command like:
sql = 'SELECT * FROM abc WHERE col_A IN (?,?,?,?) AND NOT IN (?,?,?,?) ORDER BY col_A;'
So I have tried the executor:
results = executor(sql, (tup_A,tup_B))
and
results = executor(sql, tup_A + tup_B)
but it result in
OperationalError('near "IN": syntax error',)
I have tried successfully run command with one parameter:
sql = 'SELECT * FROM abc WHERE col_A IN (?,?,?,?) ORDER BY col_A;'
results = executor(sql, tup_A)
Any help would be greatly appreciated
I realized that I missed the col_a before NOT IN clause, and this command work:
results = executor(sql, tup_A + tup_B)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.