I have a user input where I want to enter a userID and retrieve the songID's that are asscociated with that user. I'm having trouble with this because of errors around the cursor.
Database that im trying to retrieve from.
import pyodbc
import MySQLdb
import sqlite3
MusicData = sqlite3.connect("D:\lastfm-dataset-360K\msd.sqlite3")
randomVariable = raw_input('Enter something: ')
cursor = MusicData.cursor()
MusicData = "SELECT songID FROM train WHERE userID=?"
result = cursor.execute(MusicData,randomVariable)
print result
When i enter the userID i expect to get the SongID's associated with that user however I get:
---------------------------------------------------------------------------
ProgrammingError Traceback (most recent call last)
<ipython-input-16-edd40392d38f> in <module>()
25 cursor = MusicData.cursor()
26 MusicData = "SELECT songID FROM train WHERE userID=?"
---> 27 result = cursor.execute(MusicData,randomVariable)
28 print result
29
ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 40 supplied.