Skip to content

rafaelschlatter/TSIClient

Repository files navigation

TSIClient

Build Status codecov Documentation Status Codacy Badge PyPI version Downloads

The TSIClient is a Python SDK for Microsoft Azure time series insights. It provides methods to conveniently retrieve your data and is designed for analysts, data scientists and developers working with time series data in Azure TSI.

Documentation

Installation

We recommended to use a Python version >= 3.6. You can install the TSIClient from PyPi:

pip install TSIClient

Or if you want to get the latest code, directly fom GitHub:

pip install git+https://github.com/RaaLabs/TSIClient.git

Quickstart

Instantiate the TSIClient to query your TSI environment. Use the credentials from your service principal in Azure that has access to the TSI environment (you can also use environment variables to instantiate the TSIClient or provide a specific TSI api version, check the documentation).

from TSIClient import TSIClient as tsi

client = tsi.TSIClient(
    enviroment="<your-tsi-env-name>",
    client_id="<your-client-id>",
    client_secret="<your-client-secret>",
    tenant_id="<your-tenant-id>",
    applicationName="<your-app-name>">
)

You can query your timeseries data by timeseries id, timeseries name or timeseries description. The Microsoft TSI apis support aggregation, so you can specify a sampling freqency and an aggregation method. Refer to the documentation for detailed information.

data = client.query.getDataById(
    timeseries=["timeseries_id1", "timeseries_id2"],
    timespan=["2019-12-12T15:35:11.68Z", "2019-12-12T17:02:05.958Z"],
    interval="PT5M",
    aggregate="avg",
    useWarmStore=False
)

This returns a pandas dataframe, which can be used for analysis.

Contributing

Contributions are welcome. See the developer reference for details.

License

TSIClient is licensed under the MIT license. See LICENSE file for details.

About

TSIClient package to extract data from Azure Time Series Insight

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages