Raw
Raw facilitates performing raw extracts of time series data, typically filtered by a Tag Name or Device Name and an event time.
Prerequisites
Ensure you have installed the RTDIP SDK as specified in the Getting Started section.
This example is using DefaultAuth() and DatabricksSQLConnection() to authenticate and connect. You can find other ways to authenticate here. The alternative built in connection methods are either by PYODBCSQLConnection(), TURBODBCSQLConnection() or SparkConnection().
Parameters
Name | Type | Description |
---|---|---|
tag_names | list | List of tagname or tagnames ["tag_1", "tag_2"] |
start_date | str | Start date (Either a date in the format YY-MM-DD or a datetime in the format YYY-MM-DDTHH:MM:SS or specify the timezone offset in the format YYYY-MM-DDTHH:MM:SS+zz:zz) |
end_date | str | End date (Either a date in the format YY-MM-DD or a datetime in the format YYY-MM-DDTHH:MM:SS or specify the timezone offset in the format YYYY-MM-DDTHH:MM:SS+zz:zz) |
include_bad_data | bool | Include "Bad" data points with True or remove "Bad" data points with False |
Example
from rtdip_sdk.authentication.azure import DefaultAuth
from rtdip_sdk.connectors import DatabricksSQLConnection
from rtdip_sdk.queries import TimeSeriesQueryBuilder
auth = DefaultAuth().authenticate()
token = auth.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default").token
connection = DatabricksSQLConnection("{server_hostname}", "{http_path}", token)
data = (
TimeSeriesQueryBuilder()
.connect(connection)
.source("{tablename_or_path}")
.raw(
tagname_filter=["{tag_name_1}", "{tag_name_2}"],
start_date="2023-01-01",
end_date="2023-01-31",
include_bad_data=True,
)
)
print(data)