Skip to content

Commit 17c4315

Browse files
committed
chore: Write data improvements
- Format and structure serverless write-data - Structure cloud-serverless write-data/line-protocol the same as clustered and dedicated to allow for adding more tool-specific pages. - Make influxctl examples pass tests
1 parent 3274742 commit 17c4315

File tree

11 files changed

+1140
-254
lines changed

11 files changed

+1140
-254
lines changed

.prettierrc.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ trailingComma: "es5"
77
useTabs: false
88
overrides:
99
- files:
10-
- "*.md"
11-
- "*.markdown"
10+
- "*.md"
11+
- "*.markdown"
1212
options:
1313
proseWrap: "preserve"
14+
plugins:
15+
- "prettier-plugin-sql"
16+
1417
# Prettier also uses settings, such as indent, specified in .editorconfig

content/influxdb/cloud-dedicated/get-started/write.md

+57-41
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ Each line of line protocol contains the following elements:
6969
or
7070
[booleans](/influxdb/cloud-dedicated/reference/syntax/line-protocol/#boolean).
7171
- **timestamp**:
72-
[Unix timestamp](/influxdb/cloud-dedicated/reference/syntax/line-protocol/#unix-timestamp)
73-
associated with the data. InfluxDB supports up to nanosecond precision. _If
74-
the precision of the timestamp is not in nanoseconds, you must specify the
75-
precision when writing the data to InfluxDB._
72+
[Unix timestamp](/influxdb/cloud-dedicated/reference/syntax/line-protocol/#unix-timestamp)
73+
associated with the data. InfluxDB supports up to nanosecond precision. _If
74+
the precision of the timestamp is not in nanoseconds, you must specify the
75+
precision when writing the data to InfluxDB._
76+
<!-- vale InfluxDataDocs.v3Schema = YES -->
7677

7778
#### Line protocol element parsing
7879

80+
<!-- vale InfluxDataDocs.v3Schema = NO -->
81+
7982
- **measurement**: Everything before the _first unescaped comma before the first
8083
whitespace_.
8184
- **tag set**: Key-value pairs between the _first unescaped comma_ and the
@@ -98,6 +101,8 @@ _For schema design recommendations, see
98101

99102
## Construct line protocol
100103

104+
<!-- vale InfluxDataDocs.v3Schema = NO -->
105+
101106
With a basic understanding of line protocol, you can now construct line protocol
102107
and write data to InfluxDB.
103108
Consider a use case where you collect data from sensors in your home.
@@ -154,7 +159,7 @@ home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200
154159

155160
## Write line protocol to InfluxDB
156161

157-
The following examples show how to write the
162+
The following examples show how to write the preceding
158163
[sample data](#home-sensor-data-line-protocol), already in line protocol format,
159164
to an {{% product-name %}} database.
160165

@@ -235,6 +240,9 @@ home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200'
235240
{{% /code-placeholders %}}
236241
{{% /influxdb/custom-timestamps %}}
237242

243+
If successful, the output is the success message; otherwise, error details and
244+
the failure message.
245+
238246
<!----------------------------- END INFLUXCTL CLI CONTENT ----------------------------->
239247

240248
{{% /tab-content %}}
@@ -492,7 +500,8 @@ Replace the following:
492500
a [database token](/influxdb/cloud-dedicated/admin/tokens/#database-token) with
493501
sufficient permissions to the specified database
494502
495-
If successful, the output is an HTTP `204 No Content` status code.
503+
If successful, the output is an HTTP `204 No Content` status code; otherwise,
504+
the error status code and failure message.
496505
497506
<!--pytest-codeblocks:expected-output-->
498507
@@ -603,7 +612,8 @@ Replace the following:
603612
[database token](/influxdb/cloud-dedicated/admin/tokens/#database-tokens) with
604613
sufficient permissions to the specified database
605614
606-
If successful, the output is an HTTP `204 No Content` status code.
615+
If successful, the output is an HTTP `204 No Content` status code; otherwise,
616+
the error status code and failure message.
607617
608618
<!--pytest-codeblocks:expected-output-->
609619
@@ -629,17 +639,12 @@ dependencies to your current project.
629639
630640
1. Create a module directory and navigate into it--for example:
631641
632-
<!--
633-
Using bash here is required when running with pytest.
634-
I don't know why, but sh evaluates $_ to /usr/bin/pytest.
635-
-->
636-
637642
```bash
638643
mkdir -p influxdb_py_client && cd influxdb_py_client
639644
```
640645
641646
2. Setup your Python virtual environment.
642-
Inside of your module directory:
647+
Inside of your module directory, enter the following command:
643648
644649
<!--pytest-codeblocks:cont-->
645650
@@ -765,6 +770,9 @@ dependencies to your current project.
765770
766771
{{% /influxdb/custom-timestamps %}}
767772
773+
If successful, the output is the success message; otherwise, error details and
774+
the failure message.
775+
768776
<!----------------------------- END PYTHON CONTENT ---------------------------->
769777
770778
{{% /tab-content %}}
@@ -940,17 +948,17 @@ To write data to {{% product-name %}} using Go, use the InfluxDB v3
940948
}
941949
```
942950
943-
6. In your terminal, enter the following command to install the packages listed
944-
in `imports`, build the `influxdb_go_client` module, and execute the
945-
`main()` function:
951+
6. To install dependencies and write the data to your {{% product-name %}}
952+
database, enter the following command into your terminal:
946953
947954
<!--pytest.mark.skip-->
948955
949956
```sh
950-
go mod tidy && go build && go run influxdb_go_client
957+
go mod tidy && go run influxdb_go_client
951958
```
952959
953-
The program writes the line protocol to your {{% product-name %}} database.
960+
If successful, the output is the success message; otherwise, error details and
961+
the failure message.
954962
955963
{{% /influxdb/custom-timestamps %}}
956964
@@ -1146,6 +1154,9 @@ To write data to {{% product-name %}} using Go, use the InfluxDB v3
11461154
11471155
{{% /influxdb/custom-timestamps %}}
11481156
1157+
If successful, the output is the success message; otherwise, error details and
1158+
the failure message.
1159+
11491160
<!---------------------------- END NODE.JS CONTENT --------------------------->
11501161
11511162
{{% /tab-content %}}
@@ -1281,8 +1292,8 @@ To write data to {{% product-name %}} using Go, use the InfluxDB v3
12811292
with _write_ access to the specified database. _Store this in a secret
12821293
store or environment variable to avoid exposing the raw token string._
12831294
1284-
_Instantiating the client with the `using` statement ensures that the
1285-
client is disposed of when it's no longer needed._
1295+
_The `using` statement ensures that the program disposes of the
1296+
client when it's no longer needed._
12861297
12871298
2. Defines an array of line protocol strings where each string represents a
12881299
data record.
@@ -1324,19 +1335,23 @@ To write data to {{% product-name %}} using Go, use the InfluxDB v3
13241335
7. To build and execute the program and write the line protocol to your
13251336
{{% product-name %}} database, enter the following command in your terminal:
13261337
1327-
<!--pytest.mark.skip-->
1338+
<!--pytest.mark.skip-->
13281339
1329-
```sh
1330-
dotnet run
1331-
```
1340+
```sh
1341+
dotnet run
1342+
```
1343+
1344+
If successful, the output is the success message; otherwise, error details and
1345+
the failure message.
1346+
1347+
<!---------------------------- END C# CONTENT --------------------------->
13321348
1333-
<!---------------------------- END C# CONTENT --------------------------->
1349+
{{% /influxdb/custom-timestamps %}}
1350+
{{% /tab-content %}}
1351+
{{% tab-content %}}
1352+
{{% influxdb/custom-timestamps %}}
13341353
1335-
{{% /influxdb/custom-timestamps %}}
1336-
{{% /tab-content %}}
1337-
{{% tab-content %}}
1338-
{{% influxdb/custom-timestamps %}}
1339-
<!---------------------------- BEGIN JAVA CONTENT --------------------------->
1354+
<!-------------------------- BEGIN JAVA CONTENT --------------------------->
13401355
13411356
_The tutorial assumes using Maven version 3.9 and Java version >= 15._
13421357
@@ -1555,21 +1570,21 @@ _The tutorial assumes using Maven version 3.9 and Java version >= 15._
15551570
10. In your terminal or editor, execute `App.main()` to write to InfluxDB--for
15561571
example, using Maven:
15571572
1558-
<!--pytest.mark.skip-->
1559-
1560-
```sh
1561-
mvn exec:java -Dexec.mainClass="com.influxdbv3.App"
1562-
```
1563-
1564-
<!---------------------------- END JAVA CONTENT --------------------------->
1573+
<!--pytest.mark.skip-->
15651574
1566-
{{% /influxdb/custom-timestamps %}}
1567-
{{% /tab-content %}}
1568-
{{< /tabs-wrapper >}}
1575+
```sh
1576+
mvn exec:java -Dexec.mainClass="com.influxdbv3.App"
1577+
```
15691578
15701579
If successful, the output is the success message; otherwise, error details and
15711580
the failure message.
15721581
1582+
<!---------------------------- END JAVA CONTENT --------------------------->
1583+
1584+
{{% /influxdb/custom-timestamps %}}
1585+
{{% /tab-content %}}
1586+
{{< /tabs-wrapper >}}
1587+
15731588
{{< expand-wrapper >}}
15741589
{{% expand "View the written data" %}}
15751590
@@ -1610,4 +1625,5 @@ the failure message.
16101625
**Congratulations!** You've written data to InfluxDB.
16111626
Next, learn how to query your data.
16121627
1613-
{{< page-nav prev="/influxdb/cloud-dedicated/get-started/setup/" next="/influxdb/cloud-dedicated/get-started/query/" keepTab=true >}}
1628+
{{< page-nav prev="/influxdb/cloud-dedicated/get-started/setup/"
1629+
next="/influxdb/cloud-dedicated/get-started/query/" keepTab=true >}}

content/influxdb/cloud-dedicated/write-data/line-protocol/_index.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,10 @@ your data to line protocol.
2222
However, if you already have CSV data, you might want to use tools that [consume CSV
2323
and write it to InfluxDB as line protocol](/influxdb/cloud-dedicated/write-data/csv/).
2424

25-
<!-- TOC -->
26-
2725
- [Line protocol](#line-protocol)
2826
- [Line protocol elements](#line-protocol-elements)
29-
- [Line protocol element parsing](#line-protocol-element-parsing)
3027
- [Write line protocol to InfluxDB](#write-line-protocol-to-influxdb)
3128

32-
<!-- /TOC -->
33-
3429
## Line protocol
3530

3631
All data written to InfluxDB is written using [line protocol](/influxdb/cloud-dedicated/reference/syntax/line-protocol/), a text-based
@@ -44,7 +39,7 @@ Each line of line protocol contains the following elements:
4439

4540
{{< req type="key" >}}
4641

47-
- {{< req "\*" >}} **measurement**: String that identifies the [measurement](/influxdb/cloud-dedicated/reference/glossary/#measurement) to store the data in.
42+
- {{< req "\*" >}} **measurement**: String that identifies the [measurement](/influxdb/cloud-dedicated/reference/glossary/#measurement) to store the data in.
4843
- **tag set**: Comma-delimited list of key value pairs, each representing a tag.
4944
Tag keys and values are unquoted strings. _Spaces, commas, and equal characters must be escaped._
5045
- {{< req "\*" >}} **field set**: Comma-delimited list of key value pairs, each representing a field.

content/influxdb/cloud-dedicated/write-data/line-protocol/client-libraries.md

-4
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ client libraries to write data to InfluxDB v3, see
8989

9090
{{< tabs-wrapper >}}
9191
{{% tabs %}}
92-
93-
<!-- prettier-ignore -->
9492
[Go](#)
9593
[Node.js](#)
9694
[Python](#)
@@ -210,8 +208,6 @@ points.
210208

211209
{{< tabs-wrapper >}}
212210
{{% tabs %}}
213-
214-
<!-- prettier-ignore -->
215211
[Go](#)
216212
[Node.js](#)
217213
[Python](#)

0 commit comments

Comments
 (0)