Skip to content

Commit 16221ea

Browse files
committed
docs: update write example in README.md
1 parent cb15646 commit 16221ea

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ from influxdb_client_3 import write_client_options, WritePrecision, WriteOptions
9292

9393
class BatchingCallback(object):
9494

95+
def __init__(self):
96+
self.write_count = 0
97+
9598
def success(self, conf, data: str):
99+
self.write_count += 1
96100
print(f"Written batch: {conf}, data: {data}")
97101

98102
def error(self, conf, data: str, exception: InfluxDBError):
@@ -103,7 +107,7 @@ class BatchingCallback(object):
103107

104108
callback = BatchingCallback()
105109

106-
write_options = WriteOptions(batch_size=500,
110+
write_options = WriteOptions(batch_size=100,
107111
flush_interval=10_000,
108112
jitter_interval=2_000,
109113
retry_interval=5_000,
@@ -128,10 +132,7 @@ with InfluxDBClient3.InfluxDBClient3(
128132
file='./out.csv',
129133
timestamp_column='time', tag_columns=["provider", "machineID"])
130134

131-
client.write_file(
132-
file='./out.json',
133-
timestamp_column='time', tag_columns=["provider", "machineID"], date_unit='ns' )
134-
135+
print(f'DONE writing from csv in {callback.write_count} batch(es)')
135136

136137
```
137138

0 commit comments

Comments
 (0)