0

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

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I was able to find the DB-API and use the appropriate csv operations.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.