Govern Time series

Time series data can be stored in artifacts.

Retrieve time series data

import dataikuapi

host = "http(s)://DSS_HOST:DSS_PORT"
apiKey = "Your API key secret"
client = dataikuapi.GovernClient(host, apiKey)

# retrieve a specific artifact of type dataiku model version by its ID
artifact = client.get_artifact('ar.1773')

# get the time series ID from a field
ts = client.get_time_series(artifact.get_definition().get_raw()['fields']['evaluation_metrics_auc'])

# get the time series values
values = ts.get_values()

Reference API doc

class dataikuapi.govern.time_series.GovernTimeSeries(client, time_series_id)

A handle to interact with a time series. Do not create this directly, use get_time_series()

get_values(min_timestamp=None, max_timestamp=None)

Get the values of the time series. Use the parameters min_timestamp and max_timestamp to define a time window. Only values within this window will be returned

Parameters
  • min_timestamp (int) – (Optional) The minimum timestamp of the time window as an epoch in milliseconds

  • max_timestamp (int) – (Optional) The maximum timestamp of the time window as an epoch in milliseconds

Returns

a list data points of the time series as Python dict

Return type

list of dict

push_values(datapoints, upsert=True)

Push a list of values inside the time series.

Parameters
  • datapoints (list) – a list of Python dict - The list of datapoints as Python dict containing the following keys “timeSeriesId”, “timestamp” (an epoch in milliseconds), and “value” (an object)

  • upsert (boolean) – (Optional) If set to false, values for existing timestamps will not be overridden. Default value is True.

Returns

None

delete(min_timestamp=None, max_timestamp=None)

Delete the values of the time series. Use the parameters min_timestamp and max_timestamp to define a time window. Only values within this window will be deleted.

Parameters
  • min_timestamp (int) – (Optional) The minimum timestamp of the time window as an epoch in milliseconds

  • max_timestamp (int) – (Optional) The maximum timestamp of the time window as an epoch in milliseconds

Returns

None