RaaLabs / TSIClient

A python package to extract data from Azure Time Series Insights (TSI).
https://pypi.org/project/TSIClient/
MIT License
6 stars 25 forks source link

ERROR:root:"Value" for type id 1be09af9-f089-4d6b-9f0b-48018b5f7393 cannot be extracted #60

Open mvdwielen opened 3 years ago

mvdwielen commented 3 years ago

Hi,

I installed TSIClient via PyPi on databricks, I am able to instantiate a tsiclient, get the environment id and an instances.

print(tsi_client.environment.getEnvironmentId()) tsi_instances = tsi_client.instances.getInstances() print(tsi_instances["instances"][100]['timeSeriesId'])

But when executing the following code:

tsi_client.query.getDataById(timeseries=['FCDP443_PV_AT_ERR'],timespan=["2021-02-20T00:00:00.00Z", "2021-03-01T00:00:00.00Z"],interval='PT1M')

I get the error: ERROR:root:"Value" for type id 1be09af9-f089-4d6b-9f0b-48018b5f7393 cannot be extracted KeyError: '1be09af9-f089-4d6b-9f0b-48018b5f7393'

What can I do to solve this?

SiriOvregard commented 3 years ago

Hi @mvdwielen. I believe your issue is similar as the one addressed in #59.

mvdwielen commented 3 years ago

Hi @SiriOvregard looks like it is, what is the current status is it resolved yet or not?

maikberthelsen commented 3 years ago

Hi @mvdwielen. We believe the error may be caused by how the DefaultType is specified. When the type tsx are extracted the code looks for ['variables']['Value']['value']['tsx'], but we saw that in one tsi environment the Value was written with a lowercase v. By changing it to upper, as presented below, it should work.

{ "put": [ { "id": "1be09af9-f089-4d6b-9f0b-48018b5f7393", "name": "DefaultType", "description": "Default type", "variables": { "EventCount": { "kind": "aggregate", "aggregation": { "tsx": "count()" } }, "Value": { "kind": "numeric", "value": { "tsx": "$event.value.Double" }, "aggregation": { "tsx": "avg($value)" } } } } ] }

Screenshot 2021-03-11 at 08 37 22

betsalel-williamson commented 2 years ago

+1 It would be helpful to support custom key names other than Value.