I have a table of users that I want to display in a flask app. I've been trying to get the values to print out in the console but I can't seem to figure out how to do that using the key (i.e. the field name). I have the following:
cur = CONN.cursor()
cur.execute("SELECT * FROM users")
users = cur.fetchone()
print(users)
Output is:
(1, 0, 'James', 'Brubacker', 'Anaheim', 1)
When I do:
print(users['first_name'])
I get:
TypeError: tuple indices must be integers or slices, not str
I was under the assumption that fetchone() returned a dict by default but it doesn't. How can I get it to return a dict?