Skip to content

Commit eb3ca6a

Browse files
authored
Merge branch 'master' into jstirnaman/issue5781
2 parents 17ce08d + f4c3332 commit eb3ca6a

File tree

3 files changed

+258
-10
lines changed

3 files changed

+258
-10
lines changed

content/shared/influxdb3-cli/query.md

Lines changed: 114 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ influxdb3 query [OPTIONS] --database <DATABASE_NAME> [QUERY]...
1616

1717
## Arguments
1818

19-
- **QUERY**: The query string to execute.
19+
- **QUERY**: The query to execute. Provide the query in one of the following ways:
20+
21+
- a string
22+
- a path to a file that contains the query using the `--file` option
23+
- from stdin
2024

2125
## Options
2226

@@ -26,8 +30,9 @@ influxdb3 query [OPTIONS] --database <DATABASE_NAME> [QUERY]...
2630
| `-d` | `--database` | _({{< req >}})_ Name of the database to operate on |
2731
| | `--token` | Authentication token |
2832
| `-l` | `--language` | Query language of the query string (`sql` _(default)_ or `influxql`) |
29-
| | `--format` | Output format (`pretty` _(default)_, `json`, `jsonl`, `csv`, `parquet`) |
33+
| | `--format` | Output format (`pretty` _(default)_, `json`, `jsonl`, `csv`, `parquet`) |
3034
| `-o` | `--output` | Output query results to the specified file |
35+
| `-f` | `--file` | A file that contains the query to execute |
3136
| `-h` | `--help` | Print help information |
3237

3338
### Option environment variables
@@ -55,14 +60,44 @@ with the name of the database to query.
5560

5661
### Query data using SQL
5762

63+
{{< code-tabs-wrapper >}}
64+
{{% code-tabs %}}
65+
[string](#)
66+
[file](#)
67+
[stdin](#)
68+
{{% /code-tabs %}}
69+
{{% code-tab-content %}}
5870
<!--pytest.mark.skip-->
5971

6072
```bash
6173
influxdb3 query --database DATABASE_NAME 'SELECT * FROM home'
6274
```
75+
{{% /code-tab-content %}}
76+
{{% code-tab-content %}}
77+
<!--pytest.mark.skip-->
78+
79+
```bash
80+
influxdb3 query --database DATABASE_NAME --file ./query.sql
81+
```
82+
{{% /code-tab-content %}}
83+
{{% code-tab-content %}}
84+
<!--pytest.mark.skip-->
85+
86+
```bash
87+
cat ./query.sql | influxdb3 query --database DATABASE_NAME
88+
```
89+
{{% /code-tab-content %}}
90+
{{< /code-tabs-wrapper >}}
6391

6492
### Query data using InfluxQL
6593

94+
{{< code-tabs-wrapper >}}
95+
{{% code-tabs %}}
96+
[string](#)
97+
[file](#)
98+
[stdin](#)
99+
{{% /code-tabs %}}
100+
{{% code-tab-content %}}
66101
<!--pytest.mark.skip-->
67102

68103
```bash
@@ -71,9 +106,37 @@ influxdb3 query \
71106
--database DATABASE_NAME \
72107
'SELECT * FROM home'
73108
```
109+
{{% /code-tab-content %}}
110+
{{% code-tab-content %}}
111+
<!--pytest.mark.skip-->
112+
113+
```bash
114+
influxdb3 query \
115+
--language influxql \
116+
--database DATABASE_NAME \
117+
--file ./query.influxql
118+
```
119+
{{% /code-tab-content %}}
120+
{{% code-tab-content %}}
121+
<!--pytest.mark.skip-->
122+
123+
```bash
124+
cat ./query.influxql | influxdb3 query \
125+
--language influxql \
126+
--database DATABASE_NAME
127+
```
128+
{{% /code-tab-content %}}
129+
{{< /code-tabs-wrapper >}}
74130

75131
### Query data and return JSON-formatted results
76132

133+
{{< code-tabs-wrapper >}}
134+
{{% code-tabs %}}
135+
[string](#)
136+
[file](#)
137+
[stdin](#)
138+
{{% /code-tabs %}}
139+
{{% code-tab-content %}}
77140
<!--pytest.mark.skip-->
78141

79142
```bash
@@ -82,9 +145,37 @@ influxdb3 query \
82145
--database DATABASE_NAME \
83146
'SELECT * FROM home'
84147
```
148+
{{% /code-tab-content %}}
149+
{{% code-tab-content %}}
150+
<!--pytest.mark.skip-->
151+
152+
```bash
153+
influxdb3 query \
154+
--format json \
155+
--database DATABASE_NAME \
156+
--file ./query.sql
157+
```
158+
{{% /code-tab-content %}}
159+
{{% code-tab-content %}}
160+
<!--pytest.mark.skip-->
161+
162+
```bash
163+
cat ./query.sql | influxdb3 query \
164+
--format json \
165+
--database DATABASE_NAME
166+
```
167+
{{% /code-tab-content %}}
168+
{{< /code-tabs-wrapper >}}
85169

86170
### Query data and write results to a file
87171

172+
{{< code-tabs-wrapper >}}
173+
{{% code-tabs %}}
174+
[string](#)
175+
[file](#)
176+
[stdin](#)
177+
{{% /code-tabs %}}
178+
{{% code-tab-content %}}
88179
<!--pytest.mark.skip-->
89180

90181
```bash
@@ -93,5 +184,26 @@ influxdb3 query \
93184
--database DATABASE_NAME \
94185
'SELECT * FROM home'
95186
```
187+
{{% /code-tab-content %}}
188+
{{% code-tab-content %}}
189+
<!--pytest.mark.skip-->
190+
191+
```bash
192+
influxdb3 query \
193+
--output /path/to/results.txt \
194+
--database DATABASE_NAME \
195+
--file ./query.sql
196+
```
197+
{{% /code-tab-content %}}
198+
{{% code-tab-content %}}
199+
<!--pytest.mark.skip-->
200+
201+
```bash
202+
cat ./query.sql | influxdb3 query \
203+
--output /path/to/results.txt \
204+
--database DATABASE_NAME
205+
```
206+
{{% /code-tab-content %}}
207+
{{< /code-tabs-wrapper >}}
96208

97209
{{% /code-placeholders %}}

content/shared/influxdb3-cli/write.md

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,30 @@ The `influxdb3 write` command writes data to your {{< product-name >}} server.
66
<!--pytest.mark.skip-->
77

88
```bash
9-
influxdb3 write [OPTIONS] --database <DATABASE_NAME> --file <FILE_PATH>
9+
influxdb3 write [OPTIONS] --database <DATABASE_NAME> [LINE_PROTOCOL]...
1010
```
1111

1212
##### Aliases
1313

1414
`write`, `w`
1515

16+
## Arguments
17+
18+
- **LINE_PROTOCOL**: The line protocol to write to {{< product-name >}}.
19+
Provide the line protocol in one of the following ways:
20+
21+
- a string
22+
- a path to a file that contains the line protocol using the `--file` option
23+
- from stdin
24+
1625
## Options
1726

1827
| Option | | Description |
1928
| :----- | :----------------- | :--------------------------------------------------------------------------------------- |
2029
| `-H` | `--host` | Host URL of the running {{< product-name >}} server (default is `http://127.0.0.1:8181`) |
2130
| `-d` | `--database` | _({{< req >}})_ Name of the database to operate on |
2231
| | `--token` | Authentication token |
23-
| `-f` | `--file` | _({{< req >}})_ Line protocol file to use to write data |
32+
| `-f` | `--file` | A file that contains line protocol to write |
2433
| | `--accept-partial` | Accept partial writes |
2534
| `-h` | `--help` | Print help information |
2635

@@ -47,21 +56,77 @@ with the name of the database to query.
4756

4857
### Write line protocol to your InfluxDB 3 server
4958

59+
{{< code-tabs-wrapper >}}
60+
{{% code-tabs %}}
61+
[string](#)
62+
[file](#)
63+
[stdin](#)
64+
{{% /code-tabs %}}
65+
{{% code-tab-content %}}
66+
{{% influxdb/custom-timestamps %}}
67+
<!--pytest.mark.skip-->
68+
69+
```bash
70+
influxdb3 write --database DATABASE_NAME \
71+
'home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000'
72+
```
73+
{{% /influxdb/custom-timestamps %}}
74+
{{% /code-tab-content %}}
75+
{{% code-tab-content %}}
76+
<!--pytest.mark.skip-->
77+
78+
```bash
79+
influxdb3 write --database DATABASE_NAME --file ./data.lp
80+
```
81+
{{% /code-tab-content %}}
82+
{{% code-tab-content %}}
5083
<!--pytest.mark.skip-->
5184

5285
```bash
53-
influxdb3 write --database DATABASE_NAME --file /path/to/data.lp
86+
cat ./data.lp | influxdb3 write --database DATABASE_NAME
5487
```
88+
{{% /code-tab-content %}}
89+
{{< /code-tabs-wrapper >}}
5590

5691
### Write line protocol and accept partial writes
5792

93+
{{< code-tabs-wrapper >}}
94+
{{% code-tabs %}}
95+
[string](#)
96+
[file](#)
97+
[stdin](#)
98+
{{% /code-tabs %}}
99+
{{% code-tab-content %}}
100+
{{% influxdb/custom-timestamps %}}
101+
<!--pytest.mark.skip-->
102+
103+
```bash
104+
influxdb3 write \
105+
--accept-partial \
106+
--database DATABASE_NAME \
107+
'home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000'
108+
```
109+
{{% /influxdb/custom-timestamps %}}
110+
{{% /code-tab-content %}}
111+
{{% code-tab-content %}}
58112
<!--pytest.mark.skip-->
59113

60114
```bash
61115
influxdb3 write \
62116
--accept-partial \
63117
--database DATABASE_NAME \
64-
--file /path/to/data.lp
118+
--file ./data.lp
119+
```
120+
{{% /code-tab-content %}}
121+
{{% code-tab-content %}}
122+
<!--pytest.mark.skip-->
123+
124+
```bash
125+
cat ./data.lp | influxdb3 write \
126+
--accept-partial \
127+
--database DATABASE_NAME \
65128
```
129+
{{% /code-tab-content %}}
130+
{{< /code-tabs-wrapper >}}
66131

67132
{{% /code-placeholders %}}

content/shared/influxdb3-query-guides/execute-queries/influxdb3-cli.md

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ Provide the following with your command:
2323
- `sql` _(default)_
2424
- `influxql`
2525

26-
- **Query**: SQL or InfluxQL query string to execute.
26+
- **Query**: SQL or InfluxQL query to execute. Provide the query in one of the
27+
following ways:
28+
29+
- a string
30+
- the `--file` option and the path to a file that contains the query
31+
- from stdin
2732

2833
{{% code-placeholders "(DATABASE|AUTH)_(TOKEN|NAME)" %}}
2934

@@ -35,21 +40,87 @@ Provide the following with your command:
3540

3641
{{% tab-content %}}
3742

38-
```sh
43+
<!--------------------------------- BEGIN SQL --------------------------------->
44+
45+
{{< code-tabs-wrapper >}}
46+
{{% code-tabs %}}
47+
[string](#)
48+
[file](#)
49+
[stdin](#)
50+
{{% /code-tabs %}}
51+
{{% code-tab-content %}}
52+
<!--pytest.mark.skip-->
53+
54+
```bash
3955
influxdb3 query \
4056
--database DATABASE_NAME \
4157
"SELECT * FROM home"
4258
```
59+
{{% /code-tab-content %}}
60+
{{% code-tab-content %}}
61+
<!--pytest.mark.skip-->
62+
63+
```bash
64+
influxdb3 query \
65+
--database DATABASE_NAME \
66+
--file ./query.sql
67+
```
68+
{{% /code-tab-content %}}
69+
{{% code-tab-content %}}
70+
<!--pytest.mark.skip-->
71+
72+
```bash
73+
cat ./query.sql | influxdb3 query --database DATABASE_NAME
74+
```
75+
{{% /code-tab-content %}}
76+
{{< /code-tabs-wrapper >}}
77+
78+
<!---------------------------------- END SQL ---------------------------------->
79+
4380
{{% /tab-content %}}
4481

4582
{{% tab-content %}}
4683

47-
```sh
84+
<!------------------------------- BEGIN INFLUXQL ------------------------------>
85+
86+
{{< code-tabs-wrapper >}}
87+
{{% code-tabs %}}
88+
[string](#)
89+
[file](#)
90+
[stdin](#)
91+
{{% /code-tabs %}}
92+
{{% code-tab-content %}}
93+
<!--pytest.mark.skip-->
94+
95+
```bash
4896
influxdb3 query \
49-
--database DATABASE_NAME \
5097
--language influxql \
98+
--database DATABASE_NAME \
5199
"SELECT * FROM home"
52100
```
101+
{{% /code-tab-content %}}
102+
{{% code-tab-content %}}
103+
<!--pytest.mark.skip-->
104+
105+
```bash
106+
influxdb3 query \
107+
--language influxql \
108+
--database DATABASE_NAME \
109+
--file ./query.influxql
110+
```
111+
{{% /code-tab-content %}}
112+
{{% code-tab-content %}}
113+
<!--pytest.mark.skip-->
114+
115+
```bash
116+
cat ./query.influxql | influxdb3 query \
117+
--language influxql \
118+
--database DATABASE_NAME
119+
```
120+
{{% /code-tab-content %}}
121+
{{< /code-tabs-wrapper >}}
122+
123+
<!-------------------------------- END INFLUXQL ------------------------------->
53124

54125
{{% /tab-content %}}
55126
{{< /tabs-wrapper >}}

0 commit comments

Comments
 (0)