From ecbaeb2e2a738bac95987bd56746a27af71e1545 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 6 May 2024 13:16:19 -0600 Subject: [PATCH] influxctl 2.9.0 (#5459) * added --time-format to influxctl query (#5452) * update timestamp format names and command-specific release notes * Release influxctl v2.9.0 (#5458) * Release influxctl v2.9.0 * add influxctl 2.9.0 release note --------- Co-authored-by: Scott Anderson * fixed typo * updated links to rfc3339nano glossary entry --------- Co-authored-by: Joshua Powers --- .../execute-queries/influxctl-cli.md | 48 +++++++- .../reference/cli/influxctl/query.md | 104 +++++++++++++++--- .../reference/release-notes/influxctl.md | 24 ++++ .../execute-queries/influxctl-cli.md | 50 ++++++++- .../reference/cli/influxctl/query.md | 104 +++++++++++++++--- .../reference/release-notes/influxctl.md | 24 ++++ data/products.yml | 2 +- 7 files changed, 318 insertions(+), 38 deletions(-) diff --git a/content/influxdb/cloud-dedicated/query-data/execute-queries/influxctl-cli.md b/content/influxdb/cloud-dedicated/query-data/execute-queries/influxctl-cli.md index 401c28f90..a1d15ac49 100644 --- a/content/influxdb/cloud-dedicated/query-data/execute-queries/influxctl-cli.md +++ b/content/influxdb/cloud-dedicated/query-data/execute-queries/influxctl-cli.md @@ -187,35 +187,35 @@ influxctl query \ "hum": 35.9, "room": "Kitchen", "temp": 21, - "time": "2022-01-01T08:00:00Z" + "time": 1641024000000000000 }, { "co": 0, "hum": 36.2, "room": "Kitchen", "temp": 23, - "time": "2022-01-01T09:00:00Z" + "time": 1641027600000000000 }, { "co": 0, "hum": 36.1, "room": "Kitchen", "temp": 22.7, - "time": "2022-01-01T10:00:00Z" + "time": 1641031200000000000 }, { "co": 0, "hum": 36, "room": "Kitchen", "temp": 22.4, - "time": "2022-01-01T11:00:00Z" + "time": 1641034800000000000 }, { "co": 0, "hum": 36, "room": "Kitchen", "temp": 22.5, - "time": "2022-01-01T12:00:00Z" + "time": 1641038400000000000 } ] ``` @@ -223,3 +223,41 @@ influxctl query \ {{% /expand %}} {{< /expand-wrapper >}} +## Timestamp format + +When using the `table` [output format](#output-format), you can specify which of +the following timestamp formats to use to display timestamp values in the query +results: + +- `rfc3339nano`: _(Default)_ + [RFC3339Nano-formatted timestamp](/influxdb/cloud-dedicated/reference/glossary/#rfc3339nano-timestamp)--for example: + `2024-01-01T00:00:00.000000000Z` +- `unixnano`: [Unix nanosecond timestamp](/influxdb/cloud-dedicated/reference/glossary/#unix-timestamp) + +{{% influxdb/custom-timestamps %}} +```sh +influxctl query \ + --time-format unixnano \ + "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z' LIMIT 5" +``` +{{% /influxdb/custom-timestamps %}} + +{{< expand-wrapper >}} +{{% expand "View example results with unix nanosecond timestamps" %}} +{{% influxdb/custom-timestamps %}} +``` ++-------+--------+---------+------+---------------------+ +| co | hum | room | temp | time | ++-------+--------+---------+------+---------------------+ +| 0 | 35.9 | Kitchen | 21 | 1641024000000000000 | +| 0 | 36.2 | Kitchen | 23 | 1641027600000000000 | +| 0 | 36.1 | Kitchen | 22.7 | 1641031200000000000 | +| 0 | 36 | Kitchen | 22.4 | 1641034800000000000 | +| 0 | 36 | Kitchen | 22.5 | 1641038400000000000 | ++-------+--------+---------+------+---------------------+ +| TOTAL | 5 ROWS | | | | ++-------+--------+---------+------+---------------------+ +``` +{{% /influxdb/custom-timestamps %}} +{{% /expand %}} +{{< /expand-wrapper >}} diff --git a/content/influxdb/cloud-dedicated/reference/cli/influxctl/query.md b/content/influxdb/cloud-dedicated/reference/cli/influxctl/query.md index c35aecaee..1a58f28bd 100644 --- a/content/influxdb/cloud-dedicated/reference/cli/influxctl/query.md +++ b/content/influxdb/cloud-dedicated/reference/cli/influxctl/query.md @@ -49,6 +49,14 @@ The `--format` flag lets you print the output in other formats. The `json` format is available for programmatic parsing by other tooling. Default: `table`. +When using the `table` format, by default, timestamps are formatted as RFC3339 +timestamps. Use the `--time-format` flag to specify one of the available time formats: + +- `rfc3339nano`: _(Default)_ + [RFC3339Nano-formatted timestamp](/influxdb/cloud-dedicated/reference/glossary/#rfc3339nano-timestamp)--for example: + `2024-01-01T00:00:00.000000000Z` +- `unixnano`: [Unix nanosecond timestamp](/influxdb/cloud-dedicated/reference/glossary/#unix-timestamp) + ## Usage ```sh @@ -63,14 +71,15 @@ influxctl query [flags] ## Flags -| Flag | | Description | -| :--- | :----------------------- | :----------------------------------------------------------- | -| | `--database` | Database to query | -| | `--enable-system-tables` | Enable ability to query system tables | -| | `--format` | Output format (`table` _(default)_ or `json`) | -| | `--language` | Query language (`sql` _(default)_ or `influxql`) | -| | `--token` | Database token with read permissions on the queried database | -| `-h` | `--help` | Output command help | +| Flag | | Description | +| :--- | :----------------------- | :--------------------------------------------------------------------- | +| | `--database` | Database to query | +| | `--enable-system-tables` | Enable ability to query system tables | +| | `--format` | Output format (`table` _(default)_ or `json`) | +| | `--language` | Query language (`sql` _(default)_ or `influxql`) | +| | `--time-format` | Time format for table output (`rfc3339nano` _(default)_ or `unixnano`) | +| | `--token` | Database token with read permissions on the queried database | +| `-h` | `--help` | Output command help | {{% caption %}} _Also see [`influxctl` global flags](/influxdb/cloud-dedicated/reference/cli/influxctl/#global-flags)._ @@ -82,6 +91,7 @@ _Also see [`influxctl` global flags](/influxdb/cloud-dedicated/reference/cli/inf - [Query InfluxDB v3 with InfluxQL](#query-influxdb-v3-with-influxql) - [Query InfluxDB v3 and return results in table format](#query-influxdb-v3-and-return-results-in-table-format) - [Query InfluxDB v3 and return results in JSON format](#query-influxdb-v3-and-return-results-in-json-format) +- [Query InfluxDB v3 and return results with Unix nanosecond timestamps](#query-influxdb-v3-and-return-results-with-unix-nanosecond-timestamps) - [Query InfluxDB v3 using credentials from the connection profile](#query-influxdb-v3-using-credentials-from-the-connection-profile) - [Query data from InfluxDB v3 system tables](#query-data-from-influxdb-v3-system-tables) @@ -288,35 +298,35 @@ cat ./query.sql | influxctl query \ "hum": 35.9, "room": "Kitchen", "temp": 21, - "time": "2022-01-01T08:00:00Z" + "time": 1641024000000000000 }, { "co": 0, "hum": 36.2, "room": "Kitchen", "temp": 23, - "time": "2022-01-01T09:00:00Z" + "time": 1641027600000000000 }, { "co": 0, "hum": 36.1, "room": "Kitchen", "temp": 22.7, - "time": "2022-01-01T10:00:00Z" + "time": 1641031200000000000 }, { "co": 0, "hum": 36, "room": "Kitchen", "temp": 22.4, - "time": "2022-01-01T11:00:00Z" + "time": 1641034800000000000 }, { "co": 0, "hum": 36, "room": "Kitchen", "temp": 22.5, - "time": "2022-01-01T12:00:00Z" + "time": 1641038400000000000 } ] ``` @@ -324,6 +334,69 @@ cat ./query.sql | influxctl query \ {{% /expand %}} {{< /expand-wrapper >}} +### Query InfluxDB v3 and return results with Unix nanosecond timestamps + +{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}} + +{{< code-tabs-wrapper >}} +{{% code-tabs %}} +[string](#) +[file](#) +[stdin](#) +{{% /code-tabs %}} +{{% code-tab-content %}} +{{% influxdb/custom-timestamps %}} +```sh +influxctl query \ + --token DATABASE_TOKEN \ + --database DATABASE_NAME \ + --time-format unixnano \ + "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z' LIMIT 5" +``` +{{% /influxdb/custom-timestamps %}} +{{% /code-tab-content %}} +{{% code-tab-content %}} +```sh +influxctl query \ + --token DATABASE_TOKEN \ + --database DATABASE_NAME \ + --time-format unixnano \ + /path/to/query.sql +``` +{{% /code-tab-content %}} +{{% code-tab-content %}} +```sh +cat ./query.sql | influxctl query \ + --token DATABASE_TOKEN \ + --database DATABASE_NAME \ + --time-format unixnano \ + - +``` +{{% /code-tab-content %}} +{{< /code-tabs-wrapper >}} + +{{% /code-placeholders %}} + +{{< expand-wrapper >}} +{{% expand "View example table-formatted results" %}} +{{% influxdb/custom-timestamps %}} +``` ++-------+--------+---------+------+---------------------+ +| co | hum | room | temp | time | ++-------+--------+---------+------+---------------------+ +| 0 | 35.9 | Kitchen | 21 | 1641024000000000000 | +| 0 | 36.2 | Kitchen | 23 | 1641027600000000000 | +| 0 | 36.1 | Kitchen | 22.7 | 1641031200000000000 | +| 0 | 36 | Kitchen | 22.4 | 1641034800000000000 | +| 0 | 36 | Kitchen | 22.5 | 1641038400000000000 | ++-------+--------+---------+------+---------------------+ +| TOTAL | 5 ROWS | | | | ++-------+--------+---------+------+---------------------+ +``` +{{% /influxdb/custom-timestamps %}} +{{% /expand %}} +{{< /expand-wrapper >}} + ### Query InfluxDB v3 using credentials from the connection profile The following example uses the `database` and `token` defined in the `default` @@ -390,6 +463,11 @@ cat ./query.sql | influxctl query \ {{% expand "View command updates" %}} +#### v2.9.0 {date="2024-05-06"} + +- Add `--time-format` flag to specify which timestamp format to use in the + `table` output format. + #### v2.8.0 {date="2024-04-11"} - Add InfluxQL support and introduce the `--language` flag to specify the query diff --git a/content/influxdb/cloud-dedicated/reference/release-notes/influxctl.md b/content/influxdb/cloud-dedicated/reference/release-notes/influxctl.md index f0e62aaa4..d35924a63 100644 --- a/content/influxdb/cloud-dedicated/reference/release-notes/influxctl.md +++ b/content/influxdb/cloud-dedicated/reference/release-notes/influxctl.md @@ -11,6 +11,30 @@ menu: weight: 202 --- +## v2.9.0 {date="2024-05-06"} + +### Features + +- Restore default `rfc3339nano` timestamps in table output for `influxctl query` + and add the option for `unixnano` timestamps. + +### Bug Fixes + +- Update unimplemented error message with additional information. + +### Dependecy Updates +- Update `github.com/apache/arrow/go/v16` from 16.0.0-20240401180149-68241d8a86e9 to 16.0.0. +- Update `github.com/jedib0t/go-pretty/v6` from 6.5.8 to 6.5.9. +- Update `github.com/pelletier/go-toml/v2` from 2.2.0 to 2.2.1. +- Update `github.com/pelletier/go-toml/v2` from 2.2.1 to 2.2.2. +- Update `github.com/urfave/cli/v2` from 2.27.1 to 2.27.2. +- Update `golang.org/x/net` from 0.22.0 to 0.23.0. +- Update `golang.org/x/oauth2` from 0.19.0 to 0.20.0. +- Update `google.golang.org/protobuf` from 1.33.0 to 1.34.0. +- Update build dependencies. + +--- + ## v2.8.0 {date="2024-04-11"} ### Features diff --git a/content/influxdb/clustered/query-data/execute-queries/influxctl-cli.md b/content/influxdb/clustered/query-data/execute-queries/influxctl-cli.md index 2b9930c2a..d329a0c6b 100644 --- a/content/influxdb/clustered/query-data/execute-queries/influxctl-cli.md +++ b/content/influxdb/clustered/query-data/execute-queries/influxctl-cli.md @@ -141,7 +141,6 @@ Replace the following: - {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: Name of the database to query - ## Output format The `influxctl query` command supports the following output formats: @@ -186,38 +185,77 @@ influxctl query \ "hum": 35.9, "room": "Kitchen", "temp": 21, - "time": "2022-01-01T08:00:00Z" + "time": 1641024000000000000 }, { "co": 0, "hum": 36.2, "room": "Kitchen", "temp": 23, - "time": "2022-01-01T09:00:00Z" + "time": 1641027600000000000 }, { "co": 0, "hum": 36.1, "room": "Kitchen", "temp": 22.7, - "time": "2022-01-01T10:00:00Z" + "time": 1641031200000000000 }, { "co": 0, "hum": 36, "room": "Kitchen", "temp": 22.4, - "time": "2022-01-01T11:00:00Z" + "time": 1641034800000000000 }, { "co": 0, "hum": 36, "room": "Kitchen", "temp": 22.5, - "time": "2022-01-01T12:00:00Z" + "time": 1641038400000000000 } ] ``` {{% /influxdb/custom-timestamps %}} {{% /expand %}} {{< /expand-wrapper >}} + +## Timestamp format + +When using the `table` [output format](#output-format), you can specify which of +the following timestamp formats to use to display timestamp values in the query +results: + +- `rfc3339nano`: _(Default)_ + [RFC3339Nano-formatted timestamp](/influxdb/clustered/reference/glossary/#rfc3339nano-timestamp)--for example: + `2024-01-01T00:00:00.000000000Z` +- `unixnano`: [Unix nanosecond timestamp](/influxdb/clustered/reference/glossary/#unix-timestamp) + +{{% influxdb/custom-timestamps %}} +```sh +influxctl query \ + --time-format unixnano \ + "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z' LIMIT 5" +``` +{{% /influxdb/custom-timestamps %}} + +{{< expand-wrapper >}} +{{% expand "View example results with unix nanosecond timestamps" %}} +{{% influxdb/custom-timestamps %}} +``` ++-------+--------+---------+------+---------------------+ +| co | hum | room | temp | time | ++-------+--------+---------+------+---------------------+ +| 0 | 35.9 | Kitchen | 21 | 1641024000000000000 | +| 0 | 36.2 | Kitchen | 23 | 1641027600000000000 | +| 0 | 36.1 | Kitchen | 22.7 | 1641031200000000000 | +| 0 | 36 | Kitchen | 22.4 | 1641034800000000000 | +| 0 | 36 | Kitchen | 22.5 | 1641038400000000000 | ++-------+--------+---------+------+---------------------+ +| TOTAL | 5 ROWS | | | | ++-------+--------+---------+------+---------------------+ +``` +{{% /influxdb/custom-timestamps %}} +{{% /expand %}} +{{< /expand-wrapper >}} diff --git a/content/influxdb/clustered/reference/cli/influxctl/query.md b/content/influxdb/clustered/reference/cli/influxctl/query.md index a0e262330..e21721b69 100644 --- a/content/influxdb/clustered/reference/cli/influxctl/query.md +++ b/content/influxdb/clustered/reference/cli/influxctl/query.md @@ -47,6 +47,14 @@ The `--format` flag lets you print the output in other formats. The `json` format is available for programmatic parsing by other tooling. Default: `table`. +When using the `table` format, by default, timestamps are formatted as RFC3339 +timestamps. Use the `--time-format` flag to specify one of the available time formats: + +- `rfc3339nano`: _(Default)_ + [RFC3339Nano-formatted timestamp](/influxdb/clustered/reference/glossary/#rfc3339nano-timestamp)--for example: + `2024-01-01T00:00:00.000000000Z` +- `unixnano`: [Unix nanosecond timestamp](/influxdb/clustered/reference/glossary/#unix-timestamp) + ## Usage ```sh @@ -61,14 +69,15 @@ influxctl query [flags] ## Flags -| Flag | | Description | -| :--- | :----------------------- | :----------------------------------------------------------- | -| | `--database` | Database to query | -| | `--enable-system-tables` | Enable ability to query system tables | -| | `--format` | Output format (`table` _(default)_ or `json`) | -| | `--language` | Query language (`sql` _(default)_ or `influxql`) | -| | `--token` | Database token with read permissions on the queried database | -| `-h` | `--help` | Output command help | +| Flag | | Description | +| :--- | :----------------------- | :--------------------------------------------------------------------- | +| | `--database` | Database to query | +| | `--enable-system-tables` | Enable ability to query system tables | +| | `--format` | Output format (`table` _(default)_ or `json`) | +| | `--language` | Query language (`sql` _(default)_ or `influxql`) | +| | `--time-format` | Time format for table output (`rfc3339nano` _(default)_ or `unixnano`) | +| | `--token` | Database token with read permissions on the queried database | +| `-h` | `--help` | Output command help | {{% caption %}} _Also see [`influxctl` global flags](/influxdb/clustered/reference/cli/influxctl/#global-flags)._ @@ -80,6 +89,7 @@ _Also see [`influxctl` global flags](/influxdb/clustered/reference/cli/influxctl - [Query InfluxDB v3 with InfluxQL](#query-influxdb-v3-with-influxql) - [Query InfluxDB v3 and return results in table format](#query-influxdb-v3-and-return-results-in-table-format) - [Query InfluxDB v3 and return results in JSON format](#query-influxdb-v3-and-return-results-in-json-format) +- [Query InfluxDB v3 and return results with Unix nanosecond timestamps](#query-influxdb-v3-and-return-results-with-unix-nanosecond-timestamps) - [Query InfluxDB v3 using credentials from the connection profile](#query-influxdb-v3-using-credentials-from-the-connection-profile) - [Query data from InfluxDB v3 system tables](#query-data-from-influxdb-v3-system-tables) @@ -286,35 +296,35 @@ cat ./query.sql | influxctl query \ "hum": 35.9, "room": "Kitchen", "temp": 21, - "time": "2022-01-01T08:00:00Z" + "time": 1641024000000000000 }, { "co": 0, "hum": 36.2, "room": "Kitchen", "temp": 23, - "time": "2022-01-01T09:00:00Z" + "time": 1641027600000000000 }, { "co": 0, "hum": 36.1, "room": "Kitchen", "temp": 22.7, - "time": "2022-01-01T10:00:00Z" + "time": 1641031200000000000 }, { "co": 0, "hum": 36, "room": "Kitchen", "temp": 22.4, - "time": "2022-01-01T11:00:00Z" + "time": 1641034800000000000 }, { "co": 0, "hum": 36, "room": "Kitchen", "temp": 22.5, - "time": "2022-01-01T12:00:00Z" + "time": 1641038400000000000 } ] ``` @@ -322,6 +332,69 @@ cat ./query.sql | influxctl query \ {{% /expand %}} {{< /expand-wrapper >}} +### Query InfluxDB v3 and return results with Unix nanosecond timestamps + +{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}} + +{{< code-tabs-wrapper >}} +{{% code-tabs %}} +[string](#) +[file](#) +[stdin](#) +{{% /code-tabs %}} +{{% code-tab-content %}} +{{% influxdb/custom-timestamps %}} +```sh +influxctl query \ + --token DATABASE_TOKEN \ + --database DATABASE_NAME \ + --time-format unixnano \ + "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z' LIMIT 5" +``` +{{% /influxdb/custom-timestamps %}} +{{% /code-tab-content %}} +{{% code-tab-content %}} +```sh +influxctl query \ + --token DATABASE_TOKEN \ + --database DATABASE_NAME \ + --time-format unixnano \ + /path/to/query.sql +``` +{{% /code-tab-content %}} +{{% code-tab-content %}} +```sh +cat ./query.sql | influxctl query \ + --token DATABASE_TOKEN \ + --database DATABASE_NAME \ + --time-format unixnano \ + - +``` +{{% /code-tab-content %}} +{{< /code-tabs-wrapper >}} + +{{% /code-placeholders %}} + +{{< expand-wrapper >}} +{{% expand "View example table-formatted results" %}} +{{% influxdb/custom-timestamps %}} +``` ++-------+--------+---------+------+---------------------+ +| co | hum | room | temp | time | ++-------+--------+---------+------+---------------------+ +| 0 | 35.9 | Kitchen | 21 | 1641024000000000000 | +| 0 | 36.2 | Kitchen | 23 | 1641027600000000000 | +| 0 | 36.1 | Kitchen | 22.7 | 1641031200000000000 | +| 0 | 36 | Kitchen | 22.4 | 1641034800000000000 | +| 0 | 36 | Kitchen | 22.5 | 1641038400000000000 | ++-------+--------+---------+------+---------------------+ +| TOTAL | 5 ROWS | | | | ++-------+--------+---------+------+---------------------+ +``` +{{% /influxdb/custom-timestamps %}} +{{% /expand %}} +{{< /expand-wrapper >}} + ### Query InfluxDB v3 using credentials from the connection profile The following example uses the `database` and `token` defined in the `default` @@ -388,6 +461,11 @@ cat ./query.sql | influxctl query \ {{% expand "View command updates" %}} +#### v2.9.0 {date="2024-05-06"} + +- Add `--time-format` flag to specify which timestamp format to use in the + `table` output format. + #### v2.8.0 {date="2024-04-11"} - Add InfluxQL support and introduce the `--language` flag to specify the query diff --git a/content/influxdb/clustered/reference/release-notes/influxctl.md b/content/influxdb/clustered/reference/release-notes/influxctl.md index c47244e99..e52b6dcc0 100644 --- a/content/influxdb/clustered/reference/release-notes/influxctl.md +++ b/content/influxdb/clustered/reference/release-notes/influxctl.md @@ -12,6 +12,30 @@ weight: 202 canonical: /influxdb/cloud-dedicated/reference/release-notes/influxctl/ --- +## v2.9.0 {date="2024-05-06"} + +### Features + +- Restore default `rfc3339nano` timestamps in table output for `influxctl query` + and add the option for `unixnano` timestamps. + +### Bug Fixes + +- Update unimplemented error message with additional information. + +### Dependecy Updates +- Update `github.com/apache/arrow/go/v16` from 16.0.0-20240401180149-68241d8a86e9 to 16.0.0. +- Update `github.com/jedib0t/go-pretty/v6` from 6.5.8 to 6.5.9. +- Update `github.com/pelletier/go-toml/v2` from 2.2.0 to 2.2.1. +- Update `github.com/pelletier/go-toml/v2` from 2.2.1 to 2.2.2. +- Update `github.com/urfave/cli/v2` from 2.27.1 to 2.27.2. +- Update `golang.org/x/net` from 0.22.0 to 0.23.0. +- Update `golang.org/x/oauth2` from 0.19.0 to 0.20.0. +- Update `google.golang.org/protobuf` from 1.33.0 to 1.34.0. +- Update build dependencies. + +--- + ## v2.8.0 {date="2024-04-11"} `influxctl` 2.8.0 requires InfluxDB Clustered version 20240326-922145 or newer. diff --git a/data/products.yml b/data/products.yml index 6d574d2de..fcd568a6e 100644 --- a/data/products.yml +++ b/data/products.yml @@ -55,7 +55,7 @@ influxdb_cloud_dedicated: list_order: 3 latest: cloud-dedicated link: "https://www.influxdata.com/contact-sales-form/" - latest_cli: 2.8.0 + latest_cli: 2.9.0 placeholder_host: cluster-id.influxdb.io influxdb_clustered: