mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Python CLI utility and library for manipulating SQLite databases
https://sqlite-utils.datasette.io
- Python 99.7%
- C 0.2%
New mechanism for adding foreign key constraints to an existing SQLite table. SQLite ALTER TABLE does not support this out-of-the-box, so I instead had to write some careful code that uses PRAGMA writable_schema = 1 to directly modify the sqlite_master table. Refs #2 |
||
|---|---|---|
| docs | ||
| sqlite_utils | ||
| tests | ||
| .gitignore | ||
| .travis.yml | ||
| LICENSE | ||
| README.md | ||
| setup.py | ||
sqlite-utils
Python CLI utility and library for manipulating SQLite databases.
Install it like this:
pip3 install sqlite-utils
Now you can do things like this:
$ sqlite-utils tables dogs.db --counts
[{"table": "dogs", "count": 2}]
$ sqlite-utils dogs.db "select * from dogs"
[{"id": 1, "age": 4, "name": "Cleo"},
{"id": 2, "age": 2, "name": "Pancakes"}]
$ sqlite-utils dogs.db "select * from dogs" --csv
id,age,name
1,4,Cleo
2,2,Pancakes
Full documentation: https://sqlite-utils.readthedocs.io/
Related projects:
- Datasette: A tool for exploring and publishing data
- csvs-to-sqlite: Convert CSV files into a SQLite database