I am following this documentation to access my sqlite database. https://docs.python.org/3/library/sqlite3.html
Using flask I login to my site by typing in my username and password. This takes me to this route:
@app.route('/index')
def index():
db = get_db_connection()
cur = db.cursor()
print(session['userID']) # prints: 1
print(type(session['userID'])) # prints: <class 'int'>
query = """SELECT users.firstName, workouts.dateandtime, workouts.id, sets.*, exercises.name FROM users
JOIN workouts ON users.id = workouts.userID JOIN sets ON workouts.id = sets.workoutID JOIN exercises ON
sets.exerciseID = exercises.id WHERE users.id = ?"""
posts_unsorted = cur.execute(query, session['userID']).fetchall()
I get the error:
ValueError: parameters are of unsupported type
I have looked at my database to make sure the id for the user is an <int>
and it is. If I type a 1
in place of the ?
in my query the execute works but I need ot be able to look up other users.
What am I doing wrong here?