sqlite-utils

Command-line tool used to manipulate SQLite databases in a number of different ways.

TLDR

Create a database

$ sqlite-utils create-database [path/to/database.db]
copy


Create a table
$ sqlite-utils create-table [path/to/database.db] [table_name] [id integer name text height float photo blob --pk id]
copy


List tables
$ sqlite-utils tables [path/to/database.db]
copy


Upsert a record
$ [echo '[ {"id": 1, "name": "Linus Torvalds"}, {"id": 2, "name": "Steve Wozniak"}, {"id": 3, "name": "Tony Hoare"} ]'] | sqlite-utils upsert [path/to/database.db] [table_name] - [--pk id]
copy


Select records
$ sqlite-utils rows [path/to/database.db] [table_name]
copy


Delete a record
$ sqlite-utils query [path/to/database.db] "[delete from table_name where name = 'Tony Hoare']"
copy


Drop a table
$ sqlite-utils drop-table [path/to/database.db] [table_name]
copy


Show help information
$ sqlite-utils -h
copy

Copied to clipboard