Skip to content

Commit

Permalink
docs: clarifying how to use an org parameter (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar authored Mar 19, 2020
1 parent 11b9034 commit f247f23
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
Expand Down Expand Up @@ -435,7 +435,7 @@ The API also support streaming ``FluxRecord`` via `query_stream <https://github.
_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
Expand Down Expand Up @@ -514,7 +514,7 @@ The ``client`` is able to retrieve data in `Pandas DataFrame <https://pandas.pyd
_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 Pandas DataFrame
Expand Down Expand Up @@ -624,7 +624,7 @@ If you would like to import gigabytes of data then use our multiprocessing examp
"""
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__()
"""
Expand All @@ -634,7 +634,7 @@ If you would like to import gigabytes of data then use our multiprocessing examp
' |> 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
Expand Down Expand Up @@ -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)
"""
Expand Down
4 changes: 2 additions & 2 deletions examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
Expand Down
4 changes: 2 additions & 2 deletions examples/import_data_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()

"""
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/import_data_set_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/iot_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions notebooks/stock_predictions_import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '''
Expand All @@ -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))

"""
Expand Down

0 comments on commit f247f23

Please sign in to comment.