A client CLI utility for Datasette instances
  • Python 99.7%
  • Just 0.3%
Find a file
2026-02-11 17:31:08 -08:00
.github/workflows Update cache-dependency-path to pyproject.toml 2026-02-11 17:31:08 -08:00
dclient Add follow_redirects to API GET requests and showboat demo 2026-02-12 00:32:58 +00:00
docs Update documentation for new commands and output formats 2026-02-12 01:28:52 +00: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
demo.md Add follow_redirects to API GET requests and showboat demo 2026-02-12 00:32:58 +00: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 Update documentation for new commands and output formats 2026-02-12 01:28:52 +00: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

  • Explore databases, tables, schemas, and rows without writing SQL
  • Query with SQL and get results as JSON, CSV, TSV, or formatted tables
  • Insert data from CSV, TSV, JSON, or newline-delimited JSON files
  • Upsert data (insert or update based on primary key)
  • Update individual rows by primary key
  • Delete rows or drop entire tables
  • Create tables with explicit schemas
  • Run queries against authenticated Datasette instances
  • Create aliases and store authentication tokens for convenient access

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

Quick start

# Explore a Datasette instance
dclient databases https://latest.datasette.io
dclient tables https://latest.datasette.io/fixtures
dclient schema https://latest.datasette.io/fixtures

# Browse rows with filtering and sorting
dclient rows https://latest.datasette.io/fixtures/facetable --table
dclient rows https://latest.datasette.io/fixtures/facetable -w state=CA --sort city

# Fetch a single row by primary key
dclient get https://latest.datasette.io/fixtures/facetable 1

# Run a SQL query
dclient query https://latest.datasette.io/fixtures "select * from facetable limit 1"

For write operations (requires authentication):

# Create a table
dclient create-table https://example.com/db mytable \
  --column id integer --column name text --pk id

# Insert data from a CSV file
dclient insert https://example.com/db mytable data.csv --create

# Update a row
dclient update https://example.com/db/mytable 42 name=Alice age=30

# Upsert from a JSON file
dclient upsert https://example.com/db mytable data.json --json

# Delete a row
dclient delete https://example.com/db/mytable 42 --yes

# Drop a table
dclient drop https://example.com/db/mytable --yes

To shorten URLs, create an alias:

dclient alias add fixtures https://latest.datasette.io/fixtures
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 install dependencies and run tests using uv:

cd dclient
uv run pytest

To build the package:

uv build