A client CLI utility for Datasette instances
  • Python 99.7%
  • Just 0.3%
Find a file
Claude 5ee8b2d93c
Implement T1 and T2: exploration, CRUD commands, and output formats
Refactored shared infrastructure:
- _resolve_url(), _resolve_token(), _api_get(), _api_post() helpers
- Shared output formatters: JSON, CSV, TSV, NL-JSON, text table
- DCLIENT_TOKEN and DCLIENT_URL environment variable support

T1 - Core table browsing:
- `databases` - list databases on a Datasette instance
- `tables` - list tables with optional --schema flag
- `schema` - show CREATE TABLE SQL for database/table
- `rows` - browse rows with filtering (-w), sorting, pagination,
  column selection, faceting, full-text search, --limit, --all
- `get` - fetch a single row by primary key

T2 - Write operations:
- `upsert` - insert-or-update rows from file (CSV/TSV/JSON/JSONL)
- `update` - update a single row by PK with key=value pairs
- `delete` - delete a row by PK (with --yes to skip confirmation)
- `drop` - drop a table (shows row count, requires confirmation)
- `create-table` - create empty table with --column name type --pk

Output formats added to query and rows:
- --csv, --tsv, --nl, --json, --table flags

23 new tests covering all commands (62 total, all passing).

https://claude.ai/code/session_01DoiJf9Gbvbw2asN9yvP6dx
2026-02-12 00:22:12 +00:00
.github/workflows Upgrade Actions for publish of 0.4 2024-03-08 11:09:54 -05:00
dclient Implement T1 and T2: exploration, CRUD commands, and output formats 2026-02-12 00:22:12 +00:00
docs dclient actor command, closes #26 2024-02-27 21:08:15 -08:00
tests Implement T1 and T2: exploration, CRUD commands, and output formats 2026-02-12 00:22:12 +00:00
.gitignore Migrate from setup.py to pyproject.toml for uv compatibility 2026-02-12 00:16:43 +00:00
.readthedocs.yaml Create .readthedocs.yaml 2024-02-24 17:44:06 -08:00
Justfile Documentation on ReadTheDocs using MyST 2023-07-17 16:48:50 -07:00
LICENSE Initial library structure 2022-11-22 01:57:06 +00:00
PLAN.md Add comprehensive improvement plan comparing dclient to Datasette features 2026-02-12 00:09:00 +00:00
pyproject.toml Migrate from setup.py to pyproject.toml for uv compatibility 2026-02-12 00:16:43 +00:00
README.md Demonstrate aliases directly in the README 2023-07-24 21:33:46 -07:00

dclient

PyPI Changelog Tests License

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