Skip to content
Advertisement

pyodbc.ProgrammingError: (‘The SQL contains 1 parameter markers, but 7 parameters were supplied’, ‘HY000’) [closed]

When running the below script it ends in the following error, as I do find other posts on this error I am not finding the fix similar to my script.

language = ['Chinese (Simplified)', 'Chinese (Traditional)', 'English', 'French', 'Indonesian', 'Japanese', 'Korean']

cursor.execute("SELECT * from TABLE_NAME WHERE Language=?", language)
data = cursor.fetchall()

The Error I am getting :

pyodbc.ProgrammingError: ('The SQL contains 1 parameter markers, but 7 parameters were supplied', 'HY000')

Advertisement

Answer

inside language got 7 item but you only have 1 ? inside cursor.execute() you can try lan=’,’.join([str(elem) for elem in language])

cursor.execute(“SELECT * from TABLE_NAME WHERE Language in ?”, lan)

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement