feat(records): support views as record sources and in property references - #2801
feat(records): support views as record sources and in property references#2801evertoncolling wants to merge 13 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for referencing views as record sources across various data modeling operations, including ingest, upsert, aggregate, filter, and sync. It introduces the RecordViewId class and updates relevant data classes, validation logic, and unit tests. Feedback on the changes suggests using .load(data) instead of direct dictionary key access when parsing record source identifiers to robustly handle both camelCase and snake_case formats and prevent potential KeyErrors.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2801 +/- ##
==========================================
+ Coverage 93.08% 93.14% +0.05%
==========================================
Files 516 516
Lines 53386 53851 +465
==========================================
+ Hits 49697 50158 +461
- Misses 3689 3693 +4
🚀 New features to boost your workflow:
|
haakonvt
left a comment
There was a problem hiding this comment.
Good stuff, here's a few comments 😉
| RecordSource( | ||
| source=RecordContainerId(space="sp", external_id="container-x"), | ||
| properties={"temp": 22.5}, | ||
| source=ContainerId(space="sp", external_id="container-x"), |
There was a problem hiding this comment.
Maybe I don't understand the point with RecordContainerId, but shouldn't this be just that, a RecordContainerId?
If you want ContainerId to cover both instances+records then what's the point of having RecordContainerId?
There was a problem hiding this comment.
Restored RecordContainerId in the fixture and kept generic ID coverage in dedicated tests. The record-specific name communicates intent. Eligibility depends on the resource's usedFor metadata, not its ID class. ed8ae75
Co-authored-by: Håkon V. Treider <haakonvt@gmail.com>
Description
This PR extends the SDK to support using record views to read and write records: as a source when writing and reading records, and in property references for filters, aggregates, and target units.
No breaking changes. Records remains an alpha feature behind
FeaturePreviewWarning.Checklist:
If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.