%d format: a number is required not list

The mentioned query format is not secure, you can try binding in this way:

self.conn.execute('SELECT column1 FROM table_name WHERE column2 = ?', (number,))

According the docs (Sqlite3 Docs):

# Never do this -- insecure!
symbol="RHAT"
c.execute("SELECT * FROM stocks WHERE symbol="%s"" % symbol)

# Do this instead
t = ('RHAT',)
c.execute('SELECT * FROM stocks WHERE symbol=?', t)

Leave a Comment