Merge branch 'master' into docs/clustered/explain-postgresql-dsn-password-with-symbols

pull/5591/head
Jason Stirnaman 2024-09-05 08:15:30 -05:00 committed by GitHub
commit 57364e5a23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 89 additions and 106 deletions

View File

@ -55,7 +55,6 @@ swap:
fewer data: less data
file name: filename
firewalls: firewall rules
fully qualified: fully-qualified
functionality: capability|feature
Google account: Google Account
Google accounts: Google Accounts

View File

@ -39,8 +39,8 @@ as those without.
SELECT /<regular_expression_field_key>/ FROM /<regular_expression_measurement>/ WHERE [<tag_key> <operator> /<regular_expression_tag_value>/ | <field_key> <operator> /<regular_expression_field_value>/] GROUP BY /<regular_expression_tag_key>/
```
Regular expressions are surrounded by `/` characters and use
[Golang's regular expression syntax](http://golang.org/pkg/regexp/syntax/).
Regular expressions are surrounded by `/` characters and use the
[Go regular expression syntax](http://golang.org/pkg/regexp/syntax/).
## Supported operators
@ -49,6 +49,22 @@ Regular expressions are surrounded by `/` characters and use
### Examples
<!--test:setup
```bash
service influxdb start && \
influx setup \
--username USERNAME \
--token API_TOKEN \
--org ORG_NAME \
--bucket BUCKET_NAME \
--force \
&& curl -L -O \
https://s3.amazonaws.com/noaa.water-database/NOAA_data.txt \
&& influx write --bucket BUCKET_NAME --file NOAA_data.txt --precision=s \
--skipHeader 8
```
-->
{{< expand-wrapper >}}
{{% expand "Use a regular expression to specify field keys and tag keys in the SELECT clause" %}}
@ -57,7 +73,20 @@ Regular expressions are surrounded by `/` characters and use
SELECT /l/ FROM "h2o_feet" LIMIT 1
```
<!--test:prevblock
```bash
# If not 200 status, fail
curl -s -o /dev/null -w "%{http_code}" 'http://localhost:8086/query?pretty=true' \
--header "Authorization: Token API_TOKEN" \
--data-urlencode "db=BUCKET_NAME" \
--data-urlencode "rp=autogen" \
--data-urlencode "q=SELECT /l/ FROM \"h2o_feet\" LIMIT 1" \
| grep -q "200" || exit 1
```
-->
Output:
{{% influxql/table-meta %}}
Name: h2o_feet
{{% /influxql/table-meta %}}
@ -77,6 +106,40 @@ The syntax `/<regular_expression>/::[field | tag]` is not supported.
{{% /expand %}}
{{% expand "Use a regular expression to specify field keys and tag keys in function arguments" %}}
```sql
SELECT MAX(/_level/) FROM "h2o_feet" LIMIT 1
```
<!--test:prevblock
```bash
# If not 200 status, fail
curl -s \
'http://localhost:8086/query?pretty=true' \
--header "Authorization: Token API_TOKEN" \
--data-urlencode "db=BUCKET_NAME" \
--data-urlencode "rp=autogen" \
--data-urlencode "q=SELECT MAX(/_level/) FROM \"h2o_feet\"" \
| grep -Fq "\"columns\":[\"time\",\"max_water_level\"]" || exit 1
```
-->
Output:
{{% influxql/table-meta %}}
Name: h2o_feet
{{% /influxql/table-meta %}}
| time | max_water_level |
| :------------------- | ---------------------:|
| 2019-08-28T07:24:00Z | 9.964
This query uses the InfluxQL [`MAX()` selector function](/influxdb/v2/query-data/influxql/functions/selectors/#max)
to find the greatest field value out of all field keys that match the regular expression.
{{% /expand %}}
{{% expand "Use a regular expression to specify measurements in the FROM clause" %}}
```sql

View File

@ -58,7 +58,7 @@ Other supported features include:
### `FROM` clause
The `SELECT` clause specifies the measurement to query.
This clause supports several formats for specifying a [measurement(s)](/influxdb/v2/reference/glossary/#measurement):
This clause supports several formats for specifying a [measurement](/influxdb/v2/reference/glossary/#measurement):
- `FROM <measurement_name>` - Returns data from a measurement.
- `FROM <measurement_name>,<measurement_name>` - Returns data from more than one measurement.
@ -319,97 +319,19 @@ Name: h2o_feet
## Regular expressions
InfluxQL supports using regular expressions when specifying:
InfluxQL supports using [regular expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/) when specifying:
- [field keys](/influxdb/v2/reference/glossary/#field-key) and [tag keys](/influxdb/v2/reference/glossary/#tag-key) in the [`SELECT` clause](/influxdb/v2/query-data/influxql/explore-data/select/)
- [measurements](/influxdb/v2/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause)
- [tag values](/influxdb/v2/reference/glossary/#tag-value) and string [field values](/influxdb/v2/reference/glossary/#field-value) in the [`WHERE` clause](/influxdb/v2/query-data/influxql/explore-data/where/).
- [tag keys](/influxdb/v2/reference/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)
Currently, InfluxQL does not support using regular expressions to match
non-string field values in the
`WHERE` clause,
[databases](/influxdb/v2/reference/glossary/#database), and
[retention policies](/influxdb/v2/reference/glossary/#retention-policy-rp).
{{% note %}}
**Note:** Regular expression comparisons are more computationally intensive than exact
string comparisons. Queries with regular expressions are not as performant
as those without.
{{% /note %}}
## Syntax
```sql
SELECT /<regular_expression_field_key>/ FROM /<regular_expression_measurement>/ WHERE [<tag_key> <operator> /<regular_expression_tag_value>/ | <field_key> <operator> /<regular_expression_field_value>/] GROUP BY /<regular_expression_tag_key>/
```
Regular expressions are surrounded by `/` characters and use
[Golang's regular expression syntax](http://golang.org/pkg/regexp/syntax/).
## Supported operators
`=~`: matches against
`!~`: doesn't match against
## Examples
{{< expand-wrapper >}}
{{% expand "Use a regular expression to specify field keys and tag keys in the SELECT statement" %}}
#### Use a regular expression to specify field keys and tag keys in the SELECT statement
```sql
SELECT /l/ FROM "h2o_feet" LIMIT 1
```
Output:
{{% influxql/table-meta %}}
Name: h2o_feet
{{% /influxql/table-meta %}}
| time | level description | location | water_level |
| :-------------- |:----------------------| :-------------------| ------------------:|
| 2019-08-17T00:00:00Z | below 3 feet | santa_monica | 2.0640000000 |
The query selects all [field keys](/influxdb/v2/reference/glossary/#field-key)
and [tag keys](/influxdb/v2/reference/glossary/#tag-key) that include an `l`.
Note that the regular expression in the `SELECT` clause must match at least one
field key in order to return results for a tag key that matches the regular
expression.
Currently, there is no syntax to distinguish between regular expressions for
field keys and regular expressions for tag keys in the `SELECT` clause.
The syntax `/<regular_expression>/::[field | tag]` is not supported.
{{% /expand %}}
{{% expand "Use a regular expression to specify measurements in the FROM clause" %}}
```sql
SELECT MEAN("degrees") FROM /temperature/
```
Output:
{{% influxql/table-meta %}}
Name: average_temperature
{{% /influxql/table-meta %}}
| time | mean|
| :-------------- |----------------------:|
| 1970-01-01T00:00:00Z | 79.9847293223
{{% influxql/table-meta %}}
Name: h2o_temperature
{{% /influxql/table-meta %}}
| time | mean|
| :-------------- |----------------------:|
| 1970-01-01T00:00:00Z | 64.9980273540 |
This query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean) to calculate the average `degrees` for every [measurement](/influxdb/v2/reference/glossary/#measurement) in the `noaa` database that contains the word `temperature`.
{{% /expand %}}
{{< /expand-wrapper >}}
See [regular expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/) for more information.
## Data types and cast operations

View File

@ -99,6 +99,7 @@ In **extended annotated CSV**, measurements, fields, and values and their types
- [via stdin](#write-line-protocol-via-stdin)
- [from a file](#write-line-protocol-from-a-file)
- [and skip header lines](#skip-header-lines-in-a-file)
- [from multiple files](#write-line-protocol-from-multiple-files)
- [from a URL](#write-line-protocol-from-a-url)
- [from multiple URLs](#write-line-protocol-from-multiple-urls)
@ -135,6 +136,14 @@ influx write \
--file path/to/line-protocol.txt
```
##### Skip header lines in a file
```sh
influx write \
--bucket example-bucket \
--file path/to/line-protocol.txt
--skipHeader 8
```
##### Write line protocol from multiple files
```sh
influx write \

View File

@ -34,23 +34,20 @@ Server configuration commands require an [Operator token](/influxdb/v2/admin/tok
Use the [`influx server-config` command](/influxdb/v2/reference/cli/influx/server-config/)
to retrieve your runtime server configuration.
<!--test: setup
<!--test:setup
```sh
service influxdb start && \
influx setup \
--username admin \
--password adminpassword \
--token admintoken \
--org influxdatadocs \
--bucket home \
--force && INFLUX_TOKEN=admintoken \
--username USERNAME \
--token API_TOKEN \
--org ORG_NAME \
--bucket BUCKET_NAME \
--force || true
```
-->
<!-- pytest-codeblocks:cont -->
```sh
influx server-config
```
@ -226,7 +223,7 @@ _Typically, InfluxData internal use only._
influxd --assets-path=/path/to/custom/assets-dir
```
<!--test-actual
<!--test:previousblock
```sh
service influxdb stop && \
@ -283,6 +280,7 @@ user information, UI data, REST resources, and other key value data.
| `--bolt-path` | `INFLUXD_BOLT_PATH` | `bolt-path` |
###### influxd flag
<!--pytest.mark.skip-->
```sh
@ -825,7 +823,7 @@ potentially hurt performance.
influxd --http-write-timeout=10s
```
<!--test-actual
<!--test:previousblock
```sh
service influxdb stop && \

View File

@ -1,3 +1,4 @@
#datatype measurement,tag,field,field,field,time
measurement,room,temp,hum,co,time
home,Living Room,21.1,35.9,0,1712822400
home,Kitchen,21.0,35.9,0,1712822400

1 measurement #datatype measurement room tag temp field hum field co field time
1 #datatype measurement tag field field field time
2 measurement room room temp temp hum hum co time
3 home Living Room Living Room 21.1 21.1 35.9 35.9 0 1712822400
4 home Kitchen Kitchen 21.0 21.0 35.9 35.9 0 1712822400

View File

@ -6,7 +6,6 @@
# Example run command--logs are stored in the volume `influxdatadocs-oss-centos-log`:
# docker run --rm --mount type=volume,src=influxdatadocs-oss-centos-log,dst=/var/log/ influxdatadocs/oss-centos
FROM dokken/centos-stream-9:latest AS influxdb
LABEL name="test-oss-centos"
LABEL description="InfluxData Docs Test OSS install on CentOS"
@ -37,18 +36,10 @@ gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-influxdata
EOF
# Follow the install instructions (https://docs.influxdata.com/influxdb/v2.1/introduction/install/?t=Linux) for ARM, except for sudo (which isn't available in Docker).
RUN curl --silent --location -O \
"https://download.influxdata.com/influxdb/releases/influxdb2-${INFLUXDB_LATEST_PATCH}-1.${basearch}.rpm" \
&& yum localinstall -y "$(basename https://download.influxdata.com/influxdb/releases/influxdb2-${INFLUXDB_LATEST_PATCH}-1.${basearch}.rpm)"
# Follow the documentation to add the InfluxData repository to the list of repositories.
# Install InfluxDB clients to use in tests.
# Install InfluxDB and clients to use in tests.
# Follow the Telegraf install instructions (https://docs.influxdata.com/telegraf/v1/install/?t=curl), except for sudo (which isn't available in Docker).
RUN yum install -y influxdb2-cli
RUN yum install -y influxdb2 influxdb2-cli
ENTRYPOINT ["/bin/bash"]
# Run InfluxDB in the background, wait for it to start, and then test Telegraf.