Reputation: 1
So I generated a simple sqlite database called example.db with a table called wasp in Python.
c.execute('''CREATE TABLE wasp
(id INTEGER PRIMARY KEY AUTOINCREMENT, date TEXT, x INTEGER, y INTEGER, z INTEGER, temp INTEGER, bat INTEGER)''')
I was able to use Python to add data and read the data. Now I want to import this file in SQLITE using the command line. I installed sqlite3 on linux and am trying to use the .import
function but .import example.db wasp
generates an error. It says wasp is not a table. It's a table in the example.db
file but it's not a table within sqlite. So I recreated the table within sqlite and ran the command again, same problem.
What am I doing wrong?
Upvotes: 0
Views: 263
Reputation: 1121854
You do not need to use the .import
command to read the table you created from python. The .import
command is intended to import tabular text data (CSV data).
The python sqlite
module however writes native SQLite database files. Just open the example.db
file with the sqlite3 command:
$ sqlite3 example.db
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
wasp
Upvotes: 2