Skip to content

SQLite

SQLite is a lightweight version of other SQL database engines such as MySQL and PostgreSQL.

SQLite is available as a module on Apocrita.

Usage

To run the default version of SQLite, simply load the sqlite module:

$ module load sqlite
$ sqlite3 --help
Usage: sqlite3 [OPTIONS] FILENAME [SQL]

For full usage documentation, run sqlite3 --help.

Full SQL history will be written to a file named .sqlite_history in your home directory.

Example job

Serial job

Here is an example job running running on 1 core and 1GB memory:

#!/bin/bash
#$ -cwd
#$ -j y
#$ -pe smp 1
#$ -l h_rt=1:0:0
#$ -l h_vmem=1G

module load sqlite

# print the available databases inside database file "database.db"
sqlite3 database.db .databases

# print the available tables inside database file "database.db"
sqlite3 database.db .tables

# execute SQL statements (i.e. SELECT)
sqlite3 database.db "SELECT * FROM TABLE_NAME"

# dump the database contents into a file
sqlite3 database.db .dump > database.sql

References