Skip to content

feat: Streams API (ILA streams and records)#2533

Closed
andersfylling wants to merge 3 commits intomasterfrom
andersfylling/cognite-sdk/streams-ila-api
Closed

feat: Streams API (ILA streams and records)#2533
andersfylling wants to merge 3 commits intomasterfrom
andersfylling/cognite-sdk/streams-ila-api

Conversation

@andersfylling
Copy link
Copy Markdown
Contributor

Summary

Adds CogniteClient.streams (StreamsAPI) for ILA Streams and Records HTTP APIs under /streams and /streams/{streamId}/records/....

Changes

  • New cognite/client/_api/streams.py: create, list, retrieve (with includeStatistics as lowercase true/false query strings), delete (POST /streams/delete), delete_deprecated (deprecated DELETE), and record helpers ingest_records, upsert_records, delete_records, filter_records, aggregate_records, sync_records.
  • Wire StreamsAPI on CogniteClient.
  • Add streams to CogniteClientMock with spec_set=StreamsAPI.

Notes

  • Responses are raw JSON dicts (consistent with other newer thin API surfaces); typed data classes can follow in a later PR if desired.

Made with Cursor

Expose CogniteClient.streams with create/list/retrieve/delete, record
ingest/upsert/delete/filter/aggregate/sync, and deprecated single-stream
delete. Query params use string true/false for includeStatistics per API.

Made-with: Cursor
- Replace single-file StreamsAPI with cognite.client._api.streams package and
  nested StreamsRecordsAPI for /streams/{id}/records/*.
- Add data_classes.streams (Stream, Record*, response types, lists with mixins).
- Register streams in non-retryable create/delete paths and explicit record
  write paths; keep filter/aggregate/sync POSTs retryable.
- Extend CogniteClientMock and add unit tests for API and data classes.
- Document retry behavior in TestRetryableEndpoints.

Made-with: Cursor
Remove ingest_records/*_records delegators from StreamsAPI; use
client.streams.records.* only. Remove delete_deprecated (unreleased API).
Update unit test to assert records.ingest directly.

Made-with: Cursor
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 93.82239% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.36%. Comparing base (c890725) to head (a76d8f7).

Files with missing lines Patch % Lines
cognite/client/_api/streams/records.py 65.51% 10 Missing ⚠️
cognite/client/_api/streams/__init__.py 85.71% 5 Missing ⚠️
...gnite/client/data_classes/streams/stream_record.py 98.98% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2533      +/-   ##
==========================================
+ Coverage   91.35%   91.36%   +0.01%     
==========================================
  Files         192      197       +5     
  Lines       26218    26477     +259     
==========================================
+ Hits        23951    24192     +241     
- Misses       2267     2285      +18     
Files with missing lines Coverage Δ
cognite/client/_api_client.py 91.53% <ø> (ø)
cognite/client/_cognite_client.py 94.17% <100.00%> (+0.11%) ⬆️
cognite/client/data_classes/__init__.py 100.00% <100.00%> (ø)
cognite/client/data_classes/streams/__init__.py 100.00% <100.00%> (ø)
cognite/client/data_classes/streams/stream.py 100.00% <100.00%> (ø)
cognite/client/testing.py 100.00% <100.00%> (ø)
...gnite/client/data_classes/streams/stream_record.py 98.98% <98.98%> (ø)
cognite/client/_api/streams/__init__.py 85.71% <85.71%> (ø)
cognite/client/_api/streams/records.py 65.51% <65.51%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@haakonvt
Copy link
Copy Markdown
Contributor

Are you coordinating with @evertoncolling and #2519 ?

@evertoncolling
Copy link
Copy Markdown
Contributor

Are you coordinating with @evertoncolling and #2519 ?

I tried to speed things up here with #2519 (and the previous ones), but since my PRs had to wait until v8, @andersfylling will be picking it up from me and get the SDK support all the way.

Feel free to close my PR if this one gets merged 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants