Reputation: 39
Below is the sql query that is working fine:
SELECT * FROM contracts.wires.monthly_data
But it is not working in python
import sqlite3
connection = sqlite3.connect("contractsdbro")
print(connection)
crsr = connection.cursor()
crsr.execute("SELECT * FROM contracts.wires.monthly_data")
ans= crsr.fetchall()
Error:
sqlite3.OperationalError: near ".": syntax error
Upvotes: 0
Views: 177
Reputation: 69188
the valid syntax is schema-name.table-name
(you have an extra component).
You haven't provided enough information, but just guessing
crsr.execute("SELECT * FROM monthly_data")
should work.
You can use sqlite3
command-line tool to explore your database.
Upvotes: 1