Querying SQLite from Python

I am not able to reproduce the following example in jupyter lab ```# SQL Query as a string
query = “select * from recent_grads;”

Execute the query, convert the results to tuples, and store as a local variable

cursor.execute(query)

Fetch the full results set as a list of tuples

results = cursor.fetchall()

Display the first three results

print(results[0:3])```

I have ```---------------------------------------------------------------------------
OperationalError Traceback (most recent call last)
in
2 query = “select * from cursor;”
3 # Execute the query, convert the results to tuples, and store as a local variable
----> 4 cursor.execute(query)
5 # Fetch the full results set as a list of tuples
6 results = cursor.fetchall()

OperationalError: no such table: cursor```

How do I find the table name?

Try running the following query.

SELECT * FROM sqlite_master;
1 Like