Skip to content

feat(Data Modeling): support usedFor=record on containers#2621

Open
evertoncolling wants to merge 3 commits into
masterfrom
used-for-records
Open

feat(Data Modeling): support usedFor=record on containers#2621
evertoncolling wants to merge 3 commits into
masterfrom
used-for-records

Conversation

@evertoncolling
Copy link
Copy Markdown
Contributor

Description

This PR adds support for creating and querying records containers via the SDK.

  • Widen ContainerApply.used_for and Container.used_for to also accept "record", aligning with the v1 API spec (UsedFor enum = node | edge | record | all). Exposes a new public ContainerUsedFor type alias.
  • Add a used_for filter to containers.list() and containers(...) (iterate), forwarded as the usedFor query parameter on GET /models/containers. Accepts a single value or a sequence.

Checklist:

  • Tests added/updated.
  • Documentation updated. Documentation is generated from docstrings - these must be updated according to your change.
    If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.
  • The PR title follows the Conventional Commit spec.

@evertoncolling
Copy link
Copy Markdown
Contributor Author

This one would close #2391 (which was based on v7)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.01%. Comparing base (4b38aa0) to head (bfe0ca8).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2621      +/-   ##
==========================================
- Coverage   93.05%   93.01%   -0.05%     
==========================================
  Files         486      486              
  Lines       49481    49519      +38     
==========================================
+ Hits        46047    46058      +11     
- Misses       3434     3461      +27     
Files with missing lines Coverage Δ
cognite/client/_api/data_modeling/containers.py 98.14% <100.00%> (ø)
...gnite/client/_sync_api/data_modeling/containers.py 97.36% <ø> (ø)
...nite/client/data_classes/data_modeling/__init__.py 100.00% <ø> (ø)
...te/client/data_classes/data_modeling/containers.py 97.68% <100.00%> (+0.06%) ⬆️
...nit/test_api/test_data_modeling/test_containers.py 100.00% <100.00%> (ø)

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

@evertoncolling evertoncolling marked this pull request as ready for review May 12, 2026 14:06
@evertoncolling evertoncolling requested review from a team as code owners May 12, 2026 14:06
Copy link
Copy Markdown
Contributor

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

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 introduces the ability to filter containers by the 'used_for' attribute in the Data Modeling API. It adds a new 'ContainerUsedFor' type (supporting 'node', 'edge', 'record', and 'all'), updates the 'list' and 'call' methods in both async and sync container APIs to accept this filter, and includes corresponding unit tests. I have no feedback to provide.

Comment thread cognite/client/data_classes/data_modeling/containers.py
Comment thread cognite/client/data_classes/data_modeling/containers.py Outdated
Comment thread cognite/client/_sync_api/data_modeling/containers.py
Comment thread cognite/client/_sync_api/data_modeling/containers.py
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.

2 participants