I have a SQL database which I wish to run a query on through python. I have the following code:
sql='select * from mf where frequency=220258.0;'
cur.execute(sql)
Where I use the same select command in sqlite3 directly it works, but through Python no database entries are outputted.
What am I doing wrong?
Consider this SQLite database.
Python connects and queries this database like this.
Output:
You have to use one of
cur.fetchone(),cur.fetchall(), orcur.fetchmany()to get rows from the cursor. Just doingcur.execute()does not return the rows.