Merge branch 'master' into jstirnaman/DAR-463
commit
80ffbf1ea3
|
@ -8,38 +8,45 @@ menu:
|
||||||
parent: v3 client libraries
|
parent: v3 client libraries
|
||||||
identifier: influxdb3-python
|
identifier: influxdb3-python
|
||||||
influxdb/cloud-dedicated/tags: [Flight API, python, gRPC, SQL, client libraries]
|
influxdb/cloud-dedicated/tags: [Flight API, python, gRPC, SQL, client libraries]
|
||||||
metadata: [influxdb3-python v0.5.0]
|
metadata: [influxdb3-python v0.10.0]
|
||||||
weight: 201
|
weight: 201
|
||||||
aliases:
|
aliases:
|
||||||
- /influxdb/cloud-dedicated/reference/client-libraries/v3/pyinflux3/
|
- /influxdb/cloud-dedicated/reference/client-libraries/v3/pyinflux3/
|
||||||
related:
|
related:
|
||||||
- /influxdb/cloud-dedicated/query-data/execute-queries/troubleshoot/
|
- /influxdb/cloud-dedicated/query-data/execute-queries/troubleshoot/
|
||||||
list_code_example: >
|
list_code_example: |
|
||||||
|
|
||||||
|
<!--Hide setup
|
||||||
|
```python
|
||||||
|
import os
|
||||||
|
from influxdb_client_3 import InfluxDBClient3
|
||||||
|
|
||||||
|
client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
||||||
|
database=f"DATABASE_NAME", token=f"DATABASE_TOKEN")
|
||||||
|
```
|
||||||
|
-->
|
||||||
|
<!--pytest-codeblocks:cont-->
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# Example: Write and query data
|
# Example: Write and query data
|
||||||
|
|
||||||
# Write sensor data into influxDB
|
|
||||||
|
|
||||||
# and retrieve data from the last 90 days for analysis.
|
|
||||||
|
|
||||||
|
# Write sensor data in batches from a CSV file to a database
|
||||||
# Write sensor data in batches from a CSV file
|
client.write_file(file='./data/home-sensor-data.csv',
|
||||||
client.write_file(file='./data/home-sensor-data.csv', timestamp_column='time',
|
timestamp_column='time',
|
||||||
tag_columns=["room"])
|
tag_columns=["room"])
|
||||||
|
|
||||||
# Execute a query and retrieve data formatted as a PyArrow Table
|
# Execute a query and retrieve data from the last 90 days
|
||||||
table = client.query(
|
table = client.query(
|
||||||
'''SELECT *
|
'''SELECT *
|
||||||
FROM home
|
FROM home
|
||||||
WHERE time >= now() - INTERVAL '90 days'
|
WHERE time >= now() - INTERVAL '90 days'
|
||||||
ORDER BY time''')
|
ORDER BY time''')
|
||||||
|
|
||||||
# This script assumes the client object is correctly configured with your database name, token, and host URL.
|
|
||||||
# After the script runs, the table variable contains the data formatted as a PyArrow table.
|
|
||||||
|
|
||||||
```
|
# This script assumes the client object is correctly configured
|
||||||
|
# with your database name, token, and host URL.
|
||||||
|
# After the script runs, the table variable contains the data
|
||||||
|
# formatted as a PyArrow table.
|
||||||
|
```
|
||||||
---
|
---
|
||||||
|
|
||||||
The InfluxDB v3 [`influxdb3-python` Python client library](https://github.com/InfluxCommunity/influxdb3-python)
|
The InfluxDB v3 [`influxdb3-python` Python client library](https://github.com/InfluxCommunity/influxdb3-python)
|
||||||
|
@ -947,7 +954,7 @@ fh.close()
|
||||||
client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
||||||
database=f"DATABASE_NAME",
|
database=f"DATABASE_NAME",
|
||||||
token=f"DATABASE_TOKEN",
|
token=f"DATABASE_TOKEN",
|
||||||
fco=flight_client_options(tls_root_certs=cert))
|
flight_client_options=flight_client_options(tls_root_certs=cert))
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /code-placeholders %}}
|
{{% /code-placeholders %}}
|
||||||
|
|
|
@ -9,12 +9,45 @@ menu:
|
||||||
identifier: influxdb3-python
|
identifier: influxdb3-python
|
||||||
influxdb/cloud-serverless/tags:
|
influxdb/cloud-serverless/tags:
|
||||||
[Flight API, python, gRPC, SQL, client libraries]
|
[Flight API, python, gRPC, SQL, client libraries]
|
||||||
metadata: [influxdb3-python v0.5.0]
|
metadata: [influxdb3-python v0.10.0]
|
||||||
weight: 201
|
weight: 201
|
||||||
aliases:
|
aliases:
|
||||||
- /influxdb/cloud-serverless/reference/client-libraries/v3/pyinflux3/
|
- /influxdb/cloud-serverless/reference/client-libraries/v3/pyinflux3/
|
||||||
related:
|
related:
|
||||||
- /influxdb/cloud-serverless/query-data/execute-queries/troubleshoot/
|
- /influxdb/cloud-serverless/query-data/execute-queries/troubleshoot/
|
||||||
|
list_code_example: |
|
||||||
|
|
||||||
|
<!--Hide setup
|
||||||
|
```python
|
||||||
|
import os
|
||||||
|
from influxdb_client_3 import InfluxDBClient3
|
||||||
|
|
||||||
|
client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
||||||
|
database=f"BUCKET_NAME", token=f"API_TOKEN")
|
||||||
|
```
|
||||||
|
-->
|
||||||
|
<!--pytest-codeblocks:cont-->
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Example: Write and query data
|
||||||
|
|
||||||
|
# Write sensor data in batches from a CSV file to a database
|
||||||
|
client.write_file(file='./data/home-sensor-data.csv',
|
||||||
|
timestamp_column='time',
|
||||||
|
tag_columns=["room"])
|
||||||
|
|
||||||
|
# Execute a query and retrieve data from the last 90 days
|
||||||
|
table = client.query(
|
||||||
|
'''SELECT *
|
||||||
|
FROM home
|
||||||
|
WHERE time >= now() - INTERVAL '90 days'
|
||||||
|
ORDER BY time''')
|
||||||
|
|
||||||
|
# This script assumes the client object is correctly configured
|
||||||
|
# with your bucket name, token, and host URL.
|
||||||
|
# After the script runs, the table variable contains the data
|
||||||
|
# formatted as a PyArrow table.
|
||||||
|
```
|
||||||
---
|
---
|
||||||
|
|
||||||
The InfluxDB v3 [`influxdb3-python` Python client library](https://github.com/InfluxCommunity/influxdb3-python/)
|
The InfluxDB v3 [`influxdb3-python` Python client library](https://github.com/InfluxCommunity/influxdb3-python/)
|
||||||
|
@ -939,7 +972,7 @@ fh.close()
|
||||||
client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
||||||
database=f"BUCKET_NAME",
|
database=f"BUCKET_NAME",
|
||||||
token=f"API_TOKEN",
|
token=f"API_TOKEN",
|
||||||
fco=flight_client_options(tls_root_certs=cert))
|
flight_client_options=flight_client_options(tls_root_certs=cert))
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /code-placeholders %}}
|
{{% /code-placeholders %}}
|
||||||
|
|
|
@ -8,48 +8,45 @@ menu:
|
||||||
parent: v3 client libraries
|
parent: v3 client libraries
|
||||||
identifier: influxdb3-python
|
identifier: influxdb3-python
|
||||||
influxdb/clustered/tags: [Flight API, python, gRPC, SQL, client libraries]
|
influxdb/clustered/tags: [Flight API, python, gRPC, SQL, client libraries]
|
||||||
metadata: [influxdb3-python v0.5.0]
|
metadata: [influxdb3-python v0.10.0]
|
||||||
weight: 201
|
weight: 201
|
||||||
aliases:
|
aliases:
|
||||||
- /influxdb/clustered/reference/client-libraries/v3/pyinflux3/
|
- /influxdb/clustered/reference/client-libraries/v3/pyinflux3/
|
||||||
related:
|
related:
|
||||||
- /influxdb/clustered/query-data/execute-queries/troubleshoot/
|
- /influxdb/clustered/query-data/execute-queries/troubleshoot/
|
||||||
list_code_example: |
|
list_code_example: |
|
||||||
<!-- Import for tests and hide from users.
|
|
||||||
|
<!--Hide setup
|
||||||
```python
|
```python
|
||||||
import os
|
import os
|
||||||
|
from influxdb_client_3 import InfluxDBClient3
|
||||||
|
|
||||||
|
client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
||||||
|
database=f"DATABASE_NAME", token=f"DATABASE_TOKEN")
|
||||||
```
|
```
|
||||||
-->
|
-->
|
||||||
<!--pytest-codeblocks:cont-->
|
<!--pytest-codeblocks:cont-->
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from influxdb_client_3 import(InfluxDBClient3,
|
# Example: Write and query data
|
||||||
WriteOptions,
|
|
||||||
write_client_options)
|
|
||||||
|
|
||||||
# Instantiate batch writing options for the client
|
# Write sensor data in batches from a CSV file to a database
|
||||||
|
client.write_file(file='./data/home-sensor-data.csv',
|
||||||
|
timestamp_column='time',
|
||||||
|
tag_columns=["room"])
|
||||||
|
|
||||||
write_options = WriteOptions()
|
# Execute a query and retrieve data from the last 90 days
|
||||||
wco = write_client_options(write_options=write_options)
|
table = client.query(
|
||||||
|
|
||||||
# Instantiate an InfluxDB v3 client
|
|
||||||
|
|
||||||
with InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
|
||||||
database=f"DATABASE_NAME",
|
|
||||||
token=f"DATABASE_TOKEN",
|
|
||||||
write_client_options=wco) as client:
|
|
||||||
|
|
||||||
# Write data in batches
|
|
||||||
client.write_file(file='./data/home-sensor-data.csv', timestamp_column='time',
|
|
||||||
tag_columns=["room"])
|
|
||||||
|
|
||||||
# Execute a query and retrieve data formatted as a PyArrow Table
|
|
||||||
|
|
||||||
table = client.query(
|
|
||||||
'''SELECT *
|
'''SELECT *
|
||||||
FROM home
|
FROM home
|
||||||
WHERE time >= now() - INTERVAL '90 days'
|
WHERE time >= now() - INTERVAL '90 days'
|
||||||
ORDER BY time''')
|
ORDER BY time''')
|
||||||
```
|
|
||||||
|
# This script assumes the client object is correctly configured
|
||||||
|
# with your database name, token, and host URL.
|
||||||
|
# After the script runs, the table variable contains the data
|
||||||
|
# formatted as a PyArrow table.
|
||||||
|
```
|
||||||
---
|
---
|
||||||
|
|
||||||
The InfluxDB v3 [`influxdb3-python` Python client library](https://github.com/InfluxCommunity/influxdb3-python)
|
The InfluxDB v3 [`influxdb3-python` Python client library](https://github.com/InfluxCommunity/influxdb3-python)
|
||||||
|
@ -958,7 +955,7 @@ fh.close()
|
||||||
client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
|
||||||
database=f"DATABASE_NAME",
|
database=f"DATABASE_NAME",
|
||||||
token=f"DATABASE_TOKEN",
|
token=f"DATABASE_TOKEN",
|
||||||
fco=flight_client_options(tls_root_certs=cert))
|
flight_client_options=flight_client_options(tls_root_certs=cert))
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /code-placeholders %}}
|
{{% /code-placeholders %}}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 30 KiB |
Loading…
Reference in New Issue