My SQLite script works fine, when I type:
.read 'dummy.sql'
from within the SQLite shell.
However, the following Python code is not doing it properly. I'm getting a syntax error in line 5.
import sqlite3
db = sqlite3.connect('scheduling.db')
cursor=db.cursor()
a='''.read "scheduling.sql"'''
cursor.execute(a)
db.commit
db.close()
I know I'm doing something wrong with the quotes. How do I make this work?
.readis a command implemented by the sqlite3 shell program, not the sqlite3 library. You can't execute it.avariable like this:a="SELECT * FROM desired-table ORDER BY id DESC LIMIT 1"