Shelect: SQL for local files
Shelect lets you run SQL on data in your local filesystem.
Use it for easy, local ad-hoc analysis of CSV/TSV/JSON files.
It supports all functions and SQL syntax supported by SQLite.
How to use it
$ shelect 'SELECT * FROM "./examples/people.csv"'
id | name
---+-------
1 | Alice
2 | Bob
3 | Carlos
4 | Dani
$ shelect 'SELECT * FROM "./examples/values.json"'
id | value
---+------
1 | 10
2 | 20
3 | 30
3 | 40
$ shelect 'SELECT * FROM "./examples/values.json" JOIN "./examples/people.csv" USING (id)'
id | value | name
---+-------+-------
1 | 10 | Alice
2 | 20 | Bob
3 | 30 | Carlos
3 | 40 | Carlos
$ shelect 'SELECT name, sum(value) FROM "./examples/people.csv" LEFT JOIN "./examples/values.json" USING (id) GROUP BY 1'
name | SUM(value)
-------+-----------
Alice | 10
Bob | 20
Carlos | 70
Dani | NULL
It also can function as a repl when invoked without a query.
How it works
An in-memory SQLite database is created. Before executing each query, the query is parsed and all tables accessed are first imported from the filesystem into a table with that name.
So if you run SELECT * from "./my-file.csv" a table named "./my-file.csv" will be created by opening ./my-file.csv
and attempting to read it as JSON, CSV, or TSV.
JSON files must be arrays of objects, where each object is a key-value mapping where keys correspond to column names.
CSV and TSV files must have a single row with column names followed by data rows.
All columns are created as TEXT data types. Please refer to the SQLite documentation for supported SQL functions and
functionality.
How to install
shelect is on pypi: https://pypi.org/project/shelect/
Via pipx:
$ pipx install shelect
Via pip:
$ python3 -m pip install shelect
Metadata
Release files for shelect 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shelect-0.1.1.tar.gz | 8.8 kB | Without provenance | Details for shelect-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shelect-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for shelect-0.1.1-py3-none-any.whl |
Total release size: 19.3 kB
Release files / shelect-0.1.1.tar.gz
| Download URL | shelect-0.1.1.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c30430ad2f43d83d6078c371ac827c6aa3ba5151e638f027b45576ea245d891
|
|
BLAKE2b-256 checksum How to use checksums |
ba9cf5da534dd03f42bee48a205bb23919d9001f46f5f014d45a42f9aec99ee9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.5
|
Release files / shelect-0.1.1-py3-none-any.whl
| Download URL | shelect-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
537da5ccd64c40604ed5cf932358cb4ba06ad24397efad0cec17528d057b94fa
|
|
BLAKE2b-256 checksum How to use checksums |
63de6a4928e97635d484867f9a106fd30beadbe96b8066b24e17c9a2d913c43b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.5
|
Security for shelect 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.