Skip to content

feat(records): sync endpoint#2698

Open
andersfylling wants to merge 4 commits into
masterfrom
andersf/records/sync2
Open

feat(records): sync endpoint#2698
andersfylling wants to merge 4 commits into
masterfrom
andersf/records/sync2

Conversation

@andersfylling

@andersfylling andersfylling commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

See https://docs.cognite.com/20230101/records/sync-records-from-a-stream

Since we don't have hierarchical rate limiting I've chosen a number that doesn't cause issue for any configuration: https://docs.cognite.com/api-reference/concepts/20230101/rate-limits#records-request-budgets-detailed-tables

@andersfylling andersfylling marked this pull request as ready for review June 21, 2026 10:27
@andersfylling andersfylling requested review from a team as code owners June 21, 2026 10:27

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements record synchronization capabilities for data modeling, adding sync and sync_resume endpoints to both the sync and async clients, along with supporting data classes like SyncRecord and SyncRecordList. Feedback focuses on improving safety and readability, specifically by using .get() to avoid potential KeyErrors when parsing API responses in SyncRecordList and renaming a loop variable in SyncRecord to prevent parameter shadowing.

Comment thread cognite/client/data_classes/data_modeling/records.py
Comment thread cognite/client/data_classes/data_modeling/records.py
@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.36842% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.68%. Comparing base (a2722cd) to head (d3335b4).

Files with missing lines Patch % Lines
...gnite/client/data_classes/data_modeling/records.py 96.29% 3 Missing ⚠️
cognite/client/_api/data_modeling/records.py 92.30% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #2698    +/-   ##
========================================
  Coverage   93.67%   93.68%            
========================================
  Files         503      503            
  Lines       50696    50877   +181     
========================================
+ Hits        47488    47662   +174     
- Misses       3208     3215     +7     
Files with missing lines Coverage Δ
cognite/client/_sync_api/data_modeling/records.py 100.00% <100.00%> (ø)
...nite/client/data_classes/data_modeling/__init__.py 100.00% <ø> (ø)
...s_unit/test_api/test_data_modeling/test_records.py 100.00% <100.00%> (ø)
cognite/client/_api/data_modeling/records.py 96.22% <92.30%> (-3.78%) ⬇️
...gnite/client/data_classes/data_modeling/records.py 96.61% <96.29%> (-1.12%) ⬇️

... and 3 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.

andersfylling and others added 3 commits June 22, 2026 15:03
Co-authored-by: Cursor <cursoragent@cursor.com>
Separate initial sync from cursor-based continuation while sharing the request assembly and pagination through the internal _sync helper.

Co-authored-by: Cursor <cursoragent@cursor.com>
Deep-copy record property payloads when dumping so load/dump round-trip tests and callers cannot mutate the source instance through the returned dictionary.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andersfylling andersfylling force-pushed the andersf/records/sync2 branch from 4121c8b to 7233a6a Compare June 22, 2026 13:03
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.

1 participant