Skip to content

Commit

Permalink
Support create_tag in upsert_time_series (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindwe authored Jul 9, 2021
1 parent 4c1419d commit f0825a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
24 changes: 14 additions & 10 deletions exabel_data_sdk/client/api/time_series_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,28 @@ def create_time_series(self, name: str, series: pd.Series, create_tag: bool = Fa
),
)

def upsert_time_series(self, name: str, series: pd.Series) -> None:
def upsert_time_series(self, name: str, series: pd.Series, create_tag: bool = False) -> None:
"""
Create or update a time series.
Args:
name: The resource name of the time series, for example
"entityTypes/ns1.type/entities/ns2.entities/signals/ns3.signal".
An alternative name for the same time series is
"signals/ns3.signal/entityTypes/ns1.type/entities/ns2.entity". The namespaces
must be empty (being global) or one of the predetermined namespaces the
customer has access to. If ns2 is not empty, it must be equals to ns3,
and if ns1 is not empty, all three namespaces must be equal.
series: The time series data
name: The resource name of the time series, for example
"entityTypes/ns1.type/entities/ns2.entities/signals/ns3.signal".
An alternative name for the same time series is
"signals/ns3.signal/entityTypes/ns1.type/entities/ns2.entity".
The namespaces must be empty (being global) or one of the predetermined
namespaces the customer has access to. If ns2 is not empty, it must be
equals to ns3, and if ns1 is not empty, all three namespaces must be equal.
series: The time series data
create_tag: Set to true to create a tag for every entity type a signal has time series
for. If a tag already exists, it will be updated when time series are
created (or deleted) regardless of the value of this flag.
"""
if self.time_series_exists(name):
self.append_time_series_data(name, series)
else:
self.create_time_series(name, series)
self.create_time_series(name, series, create_tag)

def clear_time_series_data(self, name: str, start: pd.Timestamp, end: pd.Timestamp) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="exabel-data-sdk",
version="0.0.16",
version="0.0.17",
author="Exabel",
author_email="[email protected]",
description="Python SDK for the Exabel Data API",
Expand Down

0 comments on commit f0825a6

Please sign in to comment.