mirror of
https://github.com/simonw/dclient.git
synced 2026-07-23 09:24:31 +02:00
A client CLI utility for Datasette instances
- Python 99.7%
- Just 0.3%
New `rows` command fetches rows from a Datasette table with support for: - `-f`/`--filter column op value` mapping to `?column__op=value` query params - `--where` for raw SQL WHERE clauses (multiple allowed) - `--sort` and `--sort-desc` for sorting (mutually exclusive) - `eq` operator alias maps to Datasette's `exact` filter - All other operators passed through directly to Datasette https://claude.ai/code/session_01W24ZNk4u2qJRZ51rzx4cN7 |
||
|---|---|---|
| .github/workflows | ||
| dclient | ||
| docs | ||
| specs | ||
| tests | ||
| .gitignore | ||
| .readthedocs.yaml | ||
| Justfile | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
dclient
A client CLI utility for Datasette instances.
Much of the functionality requires Datasette 1.0a2 or higher.
Things you can do with dclient
- Run SQL queries against Datasette and returning the results as JSON
- Run queries against authenticated Datasette instances
- Create aliases and store authentication tokens for convenient access to Datasette
- Insert data into Datasette using the insert API (Datasette 1.0 alpha or higher)
Installation
Install this tool using pip:
pip install dclient
If you want to install it in the same virtual environment as Datasette (to use it as a plugin) you can instead run:
datasette install dclient
Running a query
dclient query https://latest.datasette.io/fixtures "select * from facetable limit 1"
To shorten that, create an alias:
dclient alias add fixtures https://latest.datasette.io/fixtures
Then run it like this instead:
dclient query fixtures "select * from facetable limit 1"
Documentation
Visit dclient.datasette.io for full documentation on using this tool.
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd dclient
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest