dclient/README.md
Simon Willison 3f3221fdd3 Update README and docs index for v2
Update examples to use v2 command syntax with -i flag and alias
defaults. Add quick start section showing alias add/default/default-db
workflow. Add introspection commands section. Add environment.md to
docs toctree.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 15:22:12 -08:00

2.2 KiB

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 return the results as JSON
  • Introspect databases, tables, plugins, and schema
  • Run queries against authenticated Datasette instances
  • Create aliases and set default instances/databases for convenient access
  • Insert and upsert data using the write 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

Quick start

Add an alias for a Datasette instance:

dclient alias add latest https://latest.datasette.io
dclient alias default latest
dclient alias default-db latest fixtures

Now run queries directly:

dclient "select * from facetable limit 1"

Or be explicit:

dclient query fixtures "select * from facetable limit 1" -i latest

Introspection

dclient databases
dclient tables
dclient plugins
dclient schema facetable

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