To import a file called data.csv
, first we create a table to hold that data, choose the delimiter (in this case ",") and then import the data.
sqlite> CREATE TABLE csvdata (id INTEGER, datatype_id INTEGER, level INTEGER, meaning text); sqlite> .separator "," sqlite> .import csvdata.csv test
To show the column headers when issuing a command issue:
.headers ON
In order to make sqlite always show the headers, add .headers ON
to ~/.sqliterc
.
As per the FAQ question on the SQLite FAQ, SQLite does not work well if databases are hosted on NFS filesystems. The problem is that the locks requested by SQLite do not synchronize by default with the filesystem locks on share exported by the NFS server.
One workaround is to mount the NFS share with the nolock
(Linux) or nolockd
(FreeBSD). This will enable locking on the client, such that locks will work on the client where the filesystem is mounted but they will not transfer over to the server.
A different option would be to just switch over to NFSv4 (with or without Kerberos) that takes care of this issue and synchronizes locks. NFSv4 is supported in recent versions of FreeBSD by passing nfsv4
as a mount option (can also be added to /etc/fstab
).