CredentialsBefore starting this section be sure to retrieve your API key and the appropriate Sift URL for your provisioned environment.
Instructions on how to retrieve the API key and URL and can be found in the authentication section of the documentation.
NostromoLV426, and then stream that data to Sift.
NostromoLV426 will contain a single mainmotor.velocity channel whose
values are of type double.
For full code examples, documentation, as well as the library’s source code, refer to the following:
Installing Dependencies
Before we begin streaming data to Sift we will need to install sift-stack-py. One way in which to do that is simply topip install the package.
Imports
Withsift-stack-py installed, we’ll begin by importing the necessary modules for this example. Inside of your main.py:
Data Source
Next we’ll define a data source that provides us mock sensor data. The data source will send a timestamp and afloat
over the course of a minute, sleeping for 0.5s between each send.
This will represent the time-series coming from the velocity channel:
Config
Now we define the schema of our telemetry in aTelemetryConfig which is a simple wrapper around an
ingestion config:
Client KeysAs mentioned in the ingestion config section, specifying a client key (
CONFIG_KEY in the example above) is highly recommended as it simplifies lookups for users after creation.Sending Data
Now that we have aTelemetryConfig, we will establish a connection to Sift, create an ingestion service, and initialize a run.
Runs are OptionalCreating a run is not required to send data to Sift. It’s a mechanism to group together data for a single asset or multiple assets. Read more.
ingestion_service has successfully been instantiated, Sift will have a record of your telemetry config a.k.a. your ingestion config.
Henceforth, whenever you provide the same TelemetryConfig with the same ingestion_client_key, Sift will reuse that config for future streams
for the specified asset. Additional flows and channels may be added over time.
Backwards CompatibilityNote that for a given
ingestion_client_key, adding new flows and channels over time is a safe and backwards compatible operation.
Existing flows and channels, however, should not be modified; this type of change is not considered backwards compatible and will lead
to unexpected behavior.NostromoLV426, the run we just created, as well as
data for the velocity channel.