mirror of
https://github.com/tiqi-group/pydase_service_base.git
synced 2025-04-21 00:40:01 +02:00
influxdb_v1: removes write method, updates docs
This commit is contained in:
parent
b19aeda16a
commit
9b2c26dc42
@ -107,9 +107,6 @@ with InfluxDBv1Session() as influx_client:
|
||||
}
|
||||
]
|
||||
influx_client.write_points(data=data, database="other_database")
|
||||
|
||||
# just write one point into the client's current database
|
||||
influx_client.write(data=data[0])
|
||||
```
|
||||
|
||||
### InfluxDBSession
|
||||
|
@ -9,7 +9,7 @@ except ImportError:
|
||||
from typing_extensions import Self
|
||||
|
||||
|
||||
import influxdb
|
||||
import influxdb # type: ignore
|
||||
from confz import FileSource
|
||||
|
||||
from pydase_service_base.database.config import InfluxDBv1Config, ServiceConfig
|
||||
@ -94,35 +94,6 @@ class InfluxDBv1Session:
|
||||
) -> None:
|
||||
self._client.close()
|
||||
|
||||
def write(
|
||||
self,
|
||||
data: dict[str, Any],
|
||||
) -> Any:
|
||||
"""Write data to InfluxDB.
|
||||
|
||||
Args:
|
||||
data:
|
||||
The data to be written.
|
||||
|
||||
Example:
|
||||
```python
|
||||
>>> data = {
|
||||
"measurement": "cpu_load_short",
|
||||
"tags": {
|
||||
"host": "server01",
|
||||
"region": "us-west"
|
||||
},
|
||||
"time": "2009-11-10T23:00:00Z",
|
||||
"fields": {
|
||||
"value": 0.64
|
||||
}
|
||||
}
|
||||
>>> with InfluxDBv1Session() as client:
|
||||
client.write(data=data)
|
||||
```
|
||||
"""
|
||||
self._client.write(data=data)
|
||||
|
||||
def write_points( # noqa: PLR0913
|
||||
self,
|
||||
points: list[dict[str, Any]],
|
||||
@ -158,19 +129,21 @@ class InfluxDBv1Session:
|
||||
|
||||
Example:
|
||||
```python
|
||||
>>> data = {
|
||||
"measurement": "cpu_load_short",
|
||||
"tags": {
|
||||
"host": "server01",
|
||||
"region": "us-west"
|
||||
},
|
||||
"time": "2009-11-10T23:00:00Z",
|
||||
"fields": {
|
||||
"value": 0.64
|
||||
}
|
||||
}
|
||||
>>> points = [
|
||||
... {
|
||||
... "measurement": "cpu_load_short",
|
||||
... "tags": {
|
||||
... "host": "server01",
|
||||
... "region": "us-west",
|
||||
... },
|
||||
... "time": "2009-11-10T23:00:00Z",
|
||||
... "fields": {
|
||||
... "value": 0.64,
|
||||
... },
|
||||
... }
|
||||
... ]
|
||||
>>> with InfluxDBv1Session() as client:
|
||||
client.write(data=data)
|
||||
... client.write_points(points=points)
|
||||
```
|
||||
"""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user