From f247f233ca87ce5471011e86b6ca3a0157b61cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bedn=C3=A1=C5=99?= Date: Thu, 19 Mar 2020 11:34:10 +0100 Subject: [PATCH] docs: clarifying how to use an org parameter (#76) --- CHANGELOG.md | 3 +++ README.rst | 12 ++++++------ examples/example.py | 4 ++-- examples/import_data_set.py | 4 ++-- examples/import_data_set_multiprocessing.py | 4 ++-- examples/iot_sensor.py | 2 +- examples/query.py | 2 +- notebooks/stock_predictions_import_data.py | 4 ++-- 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b15bf7c2..9d57419d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 1.6.0 [unreleased] +### Documentation +1. [#75](https://github.com/influxdata/influxdb-client-python/issues/75): Updated docs to clarify how to use an org parameter + ### Bugs 1. [#72](https://github.com/influxdata/influxdb-client-python/issues/72): Optimize serializing data into Pandas DataFrame diff --git a/README.rst b/README.rst index 2aca5055..015fb567 100644 --- a/README.rst +++ b/README.rst @@ -128,7 +128,7 @@ Please follow the `Installation`_ and then run the following: p = Point("my_measurement").tag("location", "Prague").field("temperature", 25.3) - write_api.write(bucket=bucket, org="my-org", record=p) + write_api.write(bucket=bucket, record=p) ## using Table structure tables = query_api.query('from(bucket:"my-bucket") |> range(start: -10m)') @@ -435,7 +435,7 @@ The API also support streaming ``FluxRecord`` via `query_stream range(start: 0, stop: now())' \ ' |> filter(fn: (r) => r._measurement == "financial-analysis")' \ ' |> max()' - result = client.query_api().query(org="my-org", query=query) + result = client.query_api().query(query=query) """ Processing results @@ -729,7 +729,7 @@ Efficiency write data from IOT sensor Create client that writes data into InfluxDB """ _write_api = _db_client.write_api(write_options=WriteOptions(batch_size=1)) - _write_api.write(org="my-org", bucket="my-bucket", record=data) + _write_api.write(bucket="my-bucket", record=data) """ diff --git a/examples/example.py b/examples/example.py index 390a2a86..3e42071e 100644 --- a/examples/example.py +++ b/examples/example.py @@ -14,13 +14,13 @@ p = Point("my_measurement").tag("location", "Prague").field("temperature", 25.3).time(datetime.now(), WritePrecision.MS) # write using point structure -write_api.write(org="my-org", bucket=bucket, record=p) +write_api.write(bucket=bucket, record=p) line_protocol = p.to_line_protocol() print(line_protocol) # write using line protocol string -write_api.write(org="my-org", bucket=bucket, record=line_protocol) +write_api.write(bucket=bucket, record=line_protocol) # using Table structure tables = query_api.query('from(bucket:"my-bucket") |> range(start: -1m)') diff --git a/examples/import_data_set.py b/examples/import_data_set.py index 4fe59bc7..0af2b447 100644 --- a/examples/import_data_set.py +++ b/examples/import_data_set.py @@ -70,7 +70,7 @@ def parse_row(row: OrderedDict): """ Write data into InfluxDB """ -write_api.write(org="my-org", bucket="my-bucket", record=data) +write_api.write(bucket="my-bucket", record=data) write_api.__del__() """ @@ -80,7 +80,7 @@ def parse_row(row: OrderedDict): ' |> range(start: 0, stop: now())' \ ' |> filter(fn: (r) => r._measurement == "financial-analysis")' \ ' |> max()' -result = client.query_api().query(org="my-org", query=query) +result = client.query_api().query(query=query) """ Processing results diff --git a/examples/import_data_set_multiprocessing.py b/examples/import_data_set_multiprocessing.py index 09ba91da..820cdc25 100644 --- a/examples/import_data_set_multiprocessing.py +++ b/examples/import_data_set_multiprocessing.py @@ -53,7 +53,7 @@ def run(self): self.terminate() self.queue.task_done() break - self.write_api.write(org="my-org", bucket="my-bucket", record=next_task) + self.write_api.write(bucket="my-bucket", record=next_task) self.queue.task_done() def terminate(self) -> None: @@ -200,7 +200,7 @@ def init_counter(counter, progress, queue): '|> drop(columns: ["_start", "_stop"])|> limit(n:10, offset: 0)' client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=False) -result = client.query_api().query(org="my-org", query=query) +result = client.query_api().query(query=query) """ Processing results diff --git a/examples/iot_sensor.py b/examples/iot_sensor.py index c31580db..c526a753 100644 --- a/examples/iot_sensor.py +++ b/examples/iot_sensor.py @@ -67,7 +67,7 @@ def line_protocol(temperature): Create client that writes data into InfluxDB """ _write_api = _db_client.write_api(write_options=WriteOptions(batch_size=1)) -_write_api.write(org="my-org", bucket="my-bucket", record=data) +_write_api.write(bucket="my-bucket", record=data) """ Call after terminate a script diff --git a/examples/query.py b/examples/query.py index 416a64d3..85d55a1a 100644 --- a/examples/query.py +++ b/examples/query.py @@ -13,7 +13,7 @@ _point1 = Point("my_measurement").tag("location", "Prague").field("temperature", 25.3) _point2 = Point("my_measurement").tag("location", "New York").field("temperature", 24.3) -write_api.write(bucket="my-bucket", org="my-org", record=[_point1, _point2]) +write_api.write(bucket="my-bucket", record=[_point1, _point2]) """ Query: using Table structure diff --git a/notebooks/stock_predictions_import_data.py b/notebooks/stock_predictions_import_data.py index d7bbbd1f..df6befea 100644 --- a/notebooks/stock_predictions_import_data.py +++ b/notebooks/stock_predictions_import_data.py @@ -60,7 +60,7 @@ def main(): client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=False) write_api = client.write_api(write_options=WriteOptions(batch_size=50_000, flush_interval=10_000)) - write_api.write(org="my-org", bucket="my-bucket", record=data) + write_api.write(bucket="my-bucket", record=data) write_api.__del__() query = ''' @@ -72,7 +72,7 @@ def main(): |> drop(columns: ["_start", "_stop", "table", "_field","_measurement"]) ''' - result = client.query_api().query_data_frame(org="my-org", query=query) + result = client.query_api().query_data_frame(query=query) print(result.head(100)) """