Skip to content
This repository was archived by the owner on Aug 5, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion aioinflux/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ async def write(self,
measurement: Optional[str] = None,
db: Optional[str] = None,
tag_columns: Optional[Iterable] = None,
epoch: Optional[str] = 'ns',
**extra_tags) -> bool:
"""Writes data to InfluxDB.
Input can be:
Expand All @@ -214,12 +215,14 @@ async def write(self,
for points that do not contain a `measurement` field.
:param db: Database to be written to. Defaults to `self.db`.
:param tag_columns: Columns to be treated as tags (used when writing DataFrames only)
:param epoch: Precision level of response timestamps.
Valid values: ``{'ns', 'u', 'µ', 'ms', 's', 'm', 'h'}``.
:param extra_tags: Additional tags to be added to all points passed.
:return: Returns `True` if insert is successful. Raises `ValueError` exception otherwise.
"""
data = parse_data(data, measurement, tag_columns, **extra_tags)
logger.debug(data)
url = self._url.format(endpoint='write') + '?' + urlencode(dict(db=db or self.db))
url = self._url.format(endpoint='write') + '?' + urlencode({'db': db or self.db, 'precision': epoch})
async with self._session.post(url, data=data) as resp:
if resp.status == 204:
return True
Expand Down