influxdb
influxdb copied to clipboard
feat: add `write` and `query` CLI sub-commands
This builds on #24665 and is meant to close #24651
Two new sub-commands are added to the influxdb3
CLI:
-
query
: for performing queries against the running server -
write
: for performing writes to the running server
The generated help documentation summarizes each below.
query
Perform a query against a running InfluxDB 3.0 server
Usage: influxdb3 query [OPTIONS] --dbname <DATABASE_NAME> [QUERY]...
Arguments:
[QUERY]...
The query string to execute
Options:
-h, --host <HOST_URL>
The host URL of the running InfluxDB 3.0 server
[env: INFLUXDB3_HOST_URL=]
[default: http://127.0.0.1:8181]
-d, --dbname <DATABASE_NAME>
The database name to run the query against
[env: INFLUXDB3_DATABASE_NAME=]
--token <AUTH_TOKEN>
The token for authentication with the InfluxDB 3.0 server
[env: INFLUXDB3_AUTH_TOKEN=]
--help
Print help information
-l, --lang <LANGUAGE>
The query language used to format the provided query string
[default: sql]
[possible values: sql]
--fmt <OUTPUT_FORMAT>
The format in which to output the query
If `--fmt` is set to `parquet`, then you must also specify an output file path with `--output`.
[default: pretty]
[possible values: pretty, json, csv, parquet]
-o, --output <OUTPUT_FILE_PATH>
Put all query output into `output`
write
Perform a set of writes to a running InfluxDB 3.0 server
Usage: influxdb3 write [OPTIONS] --dbname <DATABASE_NAME> --file <FILE_PATH>
Options:
-h, --host <HOST_URL>
The host URL of the running InfluxDB 3.0 server
[env: INFLUXDB3_HOST_URL=]
[default: http://127.0.0.1:8181]
-d, --dbname <DATABASE_NAME>
The database name to run the query against
[env: INFLUXDB3_DATABASE_NAME=]
--token <AUTH_TOKEN>
The token for authentication with the InfluxDB 3.0 server
[env: INFLUXDB3_AUTH_TOKEN=]
-f, --file <FILE_PATH>
File path to load the write data from
Currently, only files containing line protocol are supported.
--help
Print help information
--accept-partial
Flag to request the server accept partial writes
Invalid lines in the input data will be ignored by the server.
@mgattozzi - I pulled down main
and merged into this branch in fe7aa53 and also did the clippy thing.