2022-11-22 01:57:06 +00:00
|
|
|
# dclient
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
[](https://pypi.org/project/dclient/)
|
|
|
|
|
[](https://github.com/simonw/dclient/releases)
|
|
|
|
|
[](https://github.com/simonw/dclient/actions?query=workflow%3ATest)
|
|
|
|
|
[](https://github.com/simonw/dclient/blob/master/LICENSE)
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
A client CLI utility for Datasette instances
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
## Installation
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
Install this tool using `pip`:
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
pip install dclient
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
## Usage
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
For help, run:
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
dclient --help
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
You can also use:
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
python -m dclient --help
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-21 18:16:28 -08:00
|
|
|
### dclient query
|
|
|
|
|
|
|
|
|
|
<!-- [[[cog
|
|
|
|
|
import cog
|
|
|
|
|
from dclient import cli
|
|
|
|
|
from click.testing import CliRunner
|
|
|
|
|
runner = CliRunner()
|
|
|
|
|
result = runner.invoke(cli.cli, ["query", "--help"])
|
|
|
|
|
help = result.output.replace("Usage: cli", "Usage: dclient")
|
|
|
|
|
cog.out(
|
|
|
|
|
"```\n{}\n```".format(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.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<!-- [[[end]]] -->
|
|
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
## Development
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
To contribute to this tool, first checkout the code. Then create a new virtual environment:
|
2022-11-21 17:56:46 -08:00
|
|
|
|
2022-11-22 01:57:06 +00:00
|
|
|
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
|