Importing Delimited File

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

Showing Headers

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.

Avoiding Locking Issues for SQLite databases on NFS Mounts

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).


fuss/sqlite.txt ยท Last modified: 2017/02/22 18:30 (external edit)

Access website using Tor Access website using i2p


For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy and plagiarism pages.