Before you begin
- Python 3.x is installed.
- You have a Sift API key, gRPC URL, and REST URL. See Authentication.
How ingestion config streaming works
The Python client library uses ingestion-config-based streaming. When you define anIngestionConfigFormPy, Sift registers the schema of your telemetry (your Asset, Flows, and Channels) the first time you connect. On subsequent connections with the same client_key, Sift reuses that schema so you do not need to re-register it.
A Run groups the data you stream into a named, time-bounded capture. Runs are optional; you can stream data without one.
Stream telemetry to Sift
-
Install the
sift-stack-pypackage. -
In your
main.py, import the required modules. -
Define a data source. The following example simulates sensor data by yielding a random float every 0.5 seconds for 60 seconds.
-
Define the schema of your telemetry using
IngestionConfigFormPyandFlowConfigPy.Client keysTheCONFIG_KEY(client key) uniquely identifies your schema. Use the same key across restarts to reuse the registered schema. Adding new flows and channels over time is safe. Modifying existing flows or channels is not backwards compatible and will cause unexpected behavior. -
Create a
SiftClientand open a streaming session with a Run attached.Runs are optionalAttaching a Run groups your data into a named capture. You can omit therunparameter if you want to stream data without grouping it into a Run. -
Run the async entry point.
Verify the result
After the script finishes, open Sift and navigate to the asset (in our example,NostromoLV426). You should see:
- The asset listed under your organization.
- The Run you created, with a start time matching when the script ran.
- Data for the channel(s) visible in Explore.
Next steps
- Organize streamed data into Assets and Runs
- Stream telemetry from a running application
- Choose a streaming method