Nominal Streaming Client
raw JSON → 0.9.0 verified Fri May 01 auth: no python
Python bindings for the Nominal Rust streaming client, providing high-performance real-time data streaming with typed schemas. Current version 0.9.0, release cadence is irregular.
pip install nominal-streaming Common errors
error ImportError: cannot import name 'StreamingClient' from 'nominal' ↓
cause Trying to import from old package `nominal` instead of `nominal_streaming`.
fix
Use
from nominal_streaming import StreamingClient. error TypeError: __init__() got an unexpected keyword argument 'username' ↓
cause Authentication method changed; now uses `api_key` instead of `username`/`password`.
fix
Replace
username and password with api_key. error AttributeError: 'StreamingClient' object has no attribute 'open_channel' ↓
cause Method renamed from `open_channel` to `open_stream` in v0.9.0.
fix
Use
client.open_stream(...) instead of client.open_channel(...). Warnings
breaking The import path changed from `nominal.streaming` to `nominal_streaming` in version 0.9.0. Old code will fail with ImportError. ↓
fix Change 'from nominal.streaming import ...' to 'from nominal_streaming import ...'.
breaking The `StreamingClient` constructor no longer accepts `username`/`password`; use `api_key`. Authentication method changed. ↓
fix Replace `StreamingClient(url, username='...', password='...')` with `StreamingClient(url, api_key='...')`.
gotcha `StreamSchema` field types are strings, not Python types. Using `int` or `float` will cause a runtime TypeError. ↓
fix Use string type names: "int64", "float64", "string", etc. See docs for full list.
breaking The `read()` method now returns an iterator of `DataPoint` objects, not raw protobuf messages. ↓
fix Update code expecting protobuf objects to use `.timestamp`, `.value`, etc.
Imports
- StreamingClient wrong
from nominal.streaming import StreamingClientcorrectfrom nominal_streaming import StreamingClient - StreamSchema wrong
from nominal.streaming.schema import StreamSchemacorrectfrom nominal_streaming import StreamSchema - DataPoint wrong
from nominal.streaming.types import DataPointcorrectfrom nominal_streaming import DataPoint
Quickstart
import os
from nominal_streaming import StreamingClient, StreamSchema, DataPoint
# Replace with your credentials
url = os.environ.get('NOMINAL_URL', 'grpc://localhost:50051')
api_key = os.environ.get('NOMINAL_API_KEY', '')
client = StreamingClient(url, api_key=api_key)
# Define a schema
schema = StreamSchema([
("timestamp", "int64"),
("value", "float64"),
])
# Open a stream
stream = client.open_stream("my-stream", schema)
# Write one data point
stream.write(DataPoint(timestamp=123456789, value=42.0))
# Read back
for dp in stream.read(start=0):
print(dp)
break
stream.close()