feat(transformations): add external data source data classes - #2729
Conversation
Adds the data-class layer for the /transformations/externaldata beta endpoint (Fabric OneLake external data sources for transformations). Mirrors the polymorphic read/write pattern already used by hosted_extractors.Source/SourceWrite, since both cases share the same shape: a write-only secret that the API never returns on read.
READ/WRITE/USE actions for the new transformations external data sources endpoint, scoped to all-projects or a data set.
… redaction Round-trip dump/load is covered automatically by the generic CogniteResource suite in test_base.py (two new exclusion lines for the as_write generic test, since the client secret is never returned on read). The focused tests here cover only what that suite can't reach: format dispatch, the unknown-format fallback (including the order-dependent behavior inherited from CogniteResourceList when an unknown-format item is first in a list), as_write raising, secret redaction in repr/str, and usability status.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for external data sources in CDF Transformations, specifically adding models and capabilities for Microsoft Fabric OneLake external data sources. It includes the implementation of data classes, credentials handling with redaction, usability checks, documentation updates, and comprehensive unit tests. I have no feedback to provide as there are no review comments.
There was a problem hiding this comment.
Code Review
This pull request introduces support for external data sources (specifically Microsoft Fabric OneLake) in CDF Transformations by adding new data classes, ACL capabilities, and corresponding unit tests. The review feedback suggests improving the readability and safety of the ExternalDataSourceUsability.dump method by avoiding mutating a dictionary with pop inside a dictionary literal construction.
…ity.dump Addresses gemini-code-assist review on #2729: replace pop-inside-literal with a direct assignment guarded by a membership check.
|
The CI failure is not my PR it is pre-existing (someone messed up i guess 🤔 ): |
haakonvt
left a comment
There was a problem hiding this comment.
Very clean PR 👌 A handful of comments, otherwise LGTM
… models - Dispatching _load methods now declare their concrete return type instead of Self, since the returned instance may be a different subclass than the one the classmethod was called on. - ExternalDataSourceWrite._load's error message hints that an unrecognized format may require an SDK upgrade. - OneLakeExternalDataSourceWrite's docstring example reads the client secret from an environment variable instead of a placeholder string. - Collapse the two issubclass checks in test_base.py's exclusion filter into one using a union type. - Drop the two tests that only exercised CogniteResourceList's base-class type-check behavior, not anything specific to ExternalDataSourceList.
|
🦄 -- will wait for CI to be fixed ^^ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2729 +/- ##
==========================================
- Coverage 93.72% 93.69% -0.04%
==========================================
Files 505 507 +2
Lines 51512 51738 +226
==========================================
+ Hits 48281 48477 +196
- Misses 3231 3261 +30
🚀 New features to boost your workflow:
|
CDF-28228
Summary
Data-class layer for the transformations external data sources API — Fabric OneLake connections for
ext_onelake()in transform SQL. Data models only, no client API or docs guide (see follow-up plan below).Supersedes #2714. That PR targeted
/transformations/external_data; the contract has since moved to/transformations/externaldatawith a materially different payload:OneLakeLocationDescriptionis nowworkspaceId/containerId(UUIDs), notworkspaceName/containerNamesettings,credentials,locationDescription,formatare all required on both read and writeclientSecretis required on every write (full replace); never returned on read{"externalId": {"externalId": "..."}, "usableVersion": "..."}Endpoints / ACL
/transformations/externaldata/transformations/externaldata/delete/transformations/externaldata/usabilityProduction code
cognite/client/data_classes/transformations/externaldata.py— read/write/list models, OneLake credentials/settings, usabilitycognite/client/data_classes/capabilities.py—TransformationsExternalDataSourcesAclcognite/client/data_classes/transformations/__init__.py— re-exports (kept out of the top-leveldata_classes/__init__.pyper review)docs/source/transformations.rst— oneautomoduleline for the new moduleTests
tests/tests_unit/test_base.py— two exclusion lines (mirroring the existingSource/SourceListexclusions) so the genericas_writetests correctly skip this hierarchy; round-trip dump/load is otherwise covered automatically by that same generic suitetests/tests_unit/test_data_classes/test_capabilities.py— new ACL entries inall_acls()tests/tests_unit/test_data_classes/test_transformations/test_externaldata.py— format dispatch, unknown-format fallback (including the order-dependent behavior inherited fromCogniteResourceListwhen an unknown-format item is first in a list — a known trade-off already present forSourceList, not something new here),as_writeraising, secret redaction inrepr/str, usability statusWhat comes next
client.transformations.external_data_sources(list, upsert, delete, verify_usability), sync codegen, mocks, API teststransformations_external_data.rstquickstart + toctreeTest plan
pytest tests/tests_unit/test_base.py -k "OneLake or ExternalDataSource"— 48 passedpytest tests/tests_unit/test_base.py— 3170 passed / 7 pre-existing failures (missing optionalpandasdep, identical on baseline)pytest tests/tests_unit/test_data_classes/test_transformations/test_externaldata.py tests/tests_unit/test_data_classes/test_capabilities.py— all passingruff check/ruff format --check/mypyon all touched files — cleanpytest docs— passing