Skip to content

Commit d1909c5

Browse files
committed
docs: how to write Structured data
1 parent bc75844 commit d1909c5

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

MIGRATION_GUIDE.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -192,40 +192,25 @@ from influxdb import SeriesHelper
192192

193193
my_client = InfluxDBClient(host='127.0.0.1', port=8086, username='root', password='root', database='dbname')
194194

195-
class MySeriesHelper(SeriesHelper):
196-
"""Instantiate SeriesHelper to write points to the backend."""
197195

196+
class MySeriesHelper(SeriesHelper):
198197
class Meta:
199-
"""Meta class stores time series helper configuration."""
200-
201-
# The client should be an instance of InfluxDBClient.
202198
client = my_client
203-
204-
# The series name must be a string. Add dependent fields/tags
205-
# in curly brackets.
206199
series_name = 'events.stats.{server_name}'
207-
208-
# Defines all the fields in this time series.
209200
fields = ['some_stat', 'other_stat']
210-
211-
# Defines all the tags for the series.
212201
tags = ['server_name']
213-
214-
# Defines the number of data points to store prior to writing
215-
# on the wire.
216202
bulk_size = 5
217-
218-
# autocommit must be set to True when using bulk_size
219203
autocommit = True
220204

205+
221206
MySeriesHelper(server_name='us.east-1', some_stat=159, other_stat=10)
222207
MySeriesHelper(server_name='us.east-1', some_stat=158, other_stat=20)
223208

224209
MySeriesHelper.commit()
225210
```
226211

227-
There `influxdb-client-python` doesn't have an equivalent implementation for `MySeriesHelper`, but there is an option
228-
to use Python [Data Classes](https://docs.python.org/3/library/dataclasses.html) way.
212+
The `influxdb-client-python` doesn't have an equivalent implementation for `MySeriesHelper`, but there is an option
213+
to use Python [Data Classes](https://docs.python.org/3/library/dataclasses.html) way:
229214

230215
**influxdb-client-python**
231216

0 commit comments

Comments
 (0)