Query Time Series Data

This topic explains how to query data from an existing Time Series

Query Time Series Data

Each Time Series in your Project stores its data in an underlying time series database. Data enters the time series database when a Time Series is run by a Time Series Run Policy, which generates a result, or when you insert time series data directly. See the Insert Time Series Data section for more information on how to insert data directly.

Web Application

To query data, navigate to the Project Create space of the project that contains the Time Series you want to query. Select the Time Series of interest and click on the menu in the right side-panel that is next to the title. Then click "Query Node" to open the interactive query chart.

3200

Query data from a Time Series

Data will automatically load from the previous 5 days through the 5 days following the most recently available date. You can change the range of Natural Times and the As Of Time using the filters above the chart.

πŸ“˜

Zooming and Panning

You can zoom-in on the graph by clicking and dragging, and double-click to zoom-out completely. To pan the graph, you can hold Shift while clicking and dragging, and double-click to reset the pan.

Note: When viewing a large time range (e.g., multiple years), you will not see all of the datapoints in your time series. Instead, you will see a subset. To view all of your datapoints, try zooming into a two week period.

Download CSV

It is quick and easy to download queried data from the web application. Simply click the small arrow to the right of the plot to download the data currently displayed.

Client Library

πŸ‘

Myst Platform Client Library

To query data from a Time Series you will need to use the Myst Platform client library. You can find the Python package as well as detailed instructions for how to install it here.

Navigate to the Project Create space of the project that contains the Time Series that you want to query data from. Click on the Time Series of interest and copy the UUID of the Time Series from the right side-panel. The project UUID will be in the project URL.

After authenticating yourself in the client library, go ahead and retrieve your Time Series:

import myst

# Retrieve the project you want to use.
project = myst.Project.get(uuid="<uuid>")

# Retrieve the time series you want to query data from.
time_series = myst.TimeSeries.get(project=..., uuid="<uuid>")

Next, query data from your time series for a specific range of Natural Times and an As Of Time:

# Query data from your time series for a specific time range and as of time.
time_array = time_series.query_time_array(
    start_time=myst.Time("2022-01-01T00:00:00Z"),
    end_time=myst.Time("2022-02-01T00:00:00Z"),
    as_of_time=myst.Time("2022-02-14T00:00:00Z"),
)

Note that the Natural Times and the As Of Time all need to be aligned with the Sample Period of the Time Series. For querying historical data the As Of Time should be larger than the Natural Times.

To regularly pull time series data, you will need a pipeline to run the query code above.