Receiving 'Error: Not all parameters were used in the SQL statement' when passing list through SQL query

Viewed 21

Attempting to pass a list through a SQL query as follows:

tickerlist = ['AAPL US', 'GOOG US']

placeholders = ','.join('?' for i in range(len(tickerlist)))
qry = 'SELECT * FROM table WHERE ticker IN (%s)' % placeholders
data = pd.read_sql(qry, connection, params=tickerlist)

Receiving the error:

ProgrammingError: (mysql.connector.errors.ProgrammingError) Not all parameters were used in the SQL statement
[SQL: SELECT * FROM table WHERE ticker IN (?,?)]
[parameters: ('AAPL US', 'GOOG US')]
0 Answers
Related