mirror of
https://github.com/tiqi-group/pydase_service_base.git
synced 2025-04-20 00:20: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")
|
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
|
### InfluxDBSession
|
||||||
|
@ -9,7 +9,7 @@ except ImportError:
|
|||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
|
||||||
import influxdb
|
import influxdb # type: ignore
|
||||||
from confz import FileSource
|
from confz import FileSource
|
||||||
|
|
||||||
from pydase_service_base.database.config import InfluxDBv1Config, ServiceConfig
|
from pydase_service_base.database.config import InfluxDBv1Config, ServiceConfig
|
||||||
@ -94,35 +94,6 @@ class InfluxDBv1Session:
|
|||||||
) -> None:
|
) -> None:
|
||||||
self._client.close()
|
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
|
def write_points( # noqa: PLR0913
|
||||||
self,
|
self,
|
||||||
points: list[dict[str, Any]],
|
points: list[dict[str, Any]],
|
||||||
@ -158,19 +129,21 @@ class InfluxDBv1Session:
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
```python
|
```python
|
||||||
>>> data = {
|
>>> points = [
|
||||||
"measurement": "cpu_load_short",
|
... {
|
||||||
"tags": {
|
... "measurement": "cpu_load_short",
|
||||||
"host": "server01",
|
... "tags": {
|
||||||
"region": "us-west"
|
... "host": "server01",
|
||||||
},
|
... "region": "us-west",
|
||||||
"time": "2009-11-10T23:00:00Z",
|
... },
|
||||||
"fields": {
|
... "time": "2009-11-10T23:00:00Z",
|
||||||
"value": 0.64
|
... "fields": {
|
||||||
}
|
... "value": 0.64,
|
||||||
}
|
... },
|
||||||
|
... }
|
||||||
|
... ]
|
||||||
>>> with InfluxDBv1Session() as client:
|
>>> with InfluxDBv1Session() as client:
|
||||||
client.write(data=data)
|
... client.write_points(points=points)
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user