A client CLI utility for Datasette instances
Project description
dclient
A client CLI utility for Datasette instances
Installation
Install this tool using pip
:
pip install dclient
Running queries
You can run SQL queries against a Datasette instance like so:
$ dclient query https://latest.datasette.io/fixtures "select * from facetable limit 1"
Output:
[
{
"pk": 1,
"created": "2019-01-14 08:00:00",
"planet_int": 1,
"on_earth": 1,
"state": "CA",
"_city_id": 1,
"_neighborhood": "Mission",
"tags": "[\"tag1\", \"tag2\"]",
"complex_array": "[{\"foo\": \"bar\"}]",
"distinct_some_null": "one",
"n": "n1"
}
]
dclient query --help
Usage: dclient query [OPTIONS] URL SQL
Run a SQL query against a Datasette database URL
Returns a JSON array of objects
Options:
--help Show this message and exit.
Aliases
You can assign an alias to a Datasette database using the dclient alias
command:
dclient alias add content https://datasette.io/content
You can list aliases with dclient alias list
:
$ dclient alias list
content = https://datasette.io/content
Once registered, you can pass an alias to commands such as dclient query
:
dclient query content "select * from news limit 1"
dclient alias --help
Usage: dclient alias [OPTIONS] COMMAND [ARGS]...
Manage aliases for different instances
Options:
--help Show this message and exit.
Commands:
add Add an alias
list List aliases
remove Remove an alias
dclient alias list --help
Usage: dclient alias list [OPTIONS]
List aliases
Options:
--json Output raw JSON
--help Show this message and exit.
dclient alias add --help
Usage: dclient alias add [OPTIONS] NAME URL
Add an alias
Options:
--help Show this message and exit.
dclient alias remove --help
Usage: dclient alias remove [OPTIONS] NAME
Remove an alias
Options:
--help Show this message and exit.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dclient-0.1a1.tar.gz
.
File metadata
- Download URL: dclient-0.1a1.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32c355b2750c2a5d456b3a077d193b1afdb4e712b97b1b421b672f95cb1ae955 |
|
MD5 | 8b323f4c8c961c35c11325b0f98b34e4 |
|
BLAKE2b-256 | a09405dae0bf36898a55e80f1847c904a98a5fb3fd43807f70ccbe88f7bd8ba1 |
File details
Details for the file dclient-0.1a1-py3-none-any.whl
.
File metadata
- Download URL: dclient-0.1a1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a6025abb02d752b7eaed1d428afd57b7553f3af5442f5d487e61a4f03e030ca |
|
MD5 | ed33e6c64233688c51009a909c25206f |
|
BLAKE2b-256 | a5c9c7770ba21706346b120939c3a68a1654c45be1ea3b46777cea322e4d4aee |