I am writing a python script to import a csv file into a pre-made sqlite database. The table is already created, but I am having trouble with the following two lines of code:
c.execute('.mode csv')
c.execute('.import %s tempData', fileName)
I am getting the error message as stated above.
asked Nov 11, 2015 at 18:23
red_student
3162 gold badges6 silver badges16 bronze badges
1 Answer 1
The DB-API interface is for SQL. Those are commands meant to be used with the SQLite CLI tool and as such cannot be used with DB-API. You will need to either perform the equivalent operations in your code or invoke the CLI tool instead.
answered Nov 11, 2015 at 18:27
Ignacio Vazquez-Abrams
804k160 gold badges1.4k silver badges1.4k bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
red_student
Thank you. I was able to find the DB-API and use the appropriate csv operations.
default