Skip to content

feat(transformations): deploy OneLake external data sources - #3099

Draft
Khyat-Cognite wants to merge 15 commits into
feat/toolkit-onelake-edc-modelsfrom
feat/toolkit-onelake-edc-deploy
Draft

feat(transformations): deploy OneLake external data sources#3099
Khyat-Cognite wants to merge 15 commits into
feat/toolkit-onelake-edc-modelsfrom
feat/toolkit-onelake-edc-deploy

Conversation

@Khyat-Cognite

@Khyat-Cognite Khyat-Cognite commented Jul 10, 2026

Copy link
Copy Markdown

Description

Add deploy/pull support for Fabric OneLake external data sources in transformations.

Slice 2/3 — stacked on #3098.

Bump

  • Patch
  • Skip

Changelog

Added

  • TransformationExternalDataSourcesAPI (list/upsert/delete/verify_usability) nested under tool.transformations
  • ExternalDataSourceIO for transformations/*.ExternalDataSource.yaml deploy/dump/pull
  • ext_onelake() parsing in transformation SQL for dependency ordering
  • TransformationsExternalDataSourcesAcl and access validation
  • Unit tests for IO, parser, and transformation dependencies

Made with Cursor

Khyat-Cognite and others added 2 commits July 10, 2026 09:03
Wire TransformationExternalDataSourcesAPI, ExternalDataSourceIO, ACLs,
ext_onelake() dependency ordering, dump support, and unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add example module YAML/SQL under examples/transformations and a
Fabric-gated integration lifecycle test.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@Khyat-Cognite

Copy link
Copy Markdown
Author

/gemini review

@Khyat-Cognite Khyat-Cognite self-assigned this Jul 10, 2026

@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 introduces support for Fabric OneLake external data sources used by transformations, adding the TransformationExternalDataSourcesAPI client, the ExternalDataSourceIO resource handler, corresponding ACLs, and integration with TransformationIO to automatically detect dependencies via SQL query parsing. The review feedback suggests adhering to the repository style guide by using absolute imports, safely retrieving external IDs from dictionaries to prevent KeyErrors, optimizing the retrieve method with an early return for empty inputs, and correctly supporting dataset filtering in _iterate to avoid breaking CLI commands like dump or pull.

Comment thread cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/external_data_source.py Outdated
Comment thread cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/external_data_source.py Outdated
Comment thread cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/external_data_source.py Outdated
Khyat-Cognite and others added 4 commits July 10, 2026 09:20
Use format as a Pydantic field, fix annotation shadowing on Python 3.12,
harden ExternalDataSourceIO retrieve/iterate/get_id, add ACL Action enum,
and fix test lint issues.

Co-authored-by: Cursor <cursoragent@cursor.com>
Fix Python 3.12 annotation shadowing, harden ExternalDataSourceIO,
add ACL Action enum, and use absolute imports where requested.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Khyat-Cognite

Copy link
Copy Markdown
Author

/gemini review

@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 adds support for Fabric OneLake external data sources used by transformations, introducing the TransformationExternalDataSourcesAPI client, TransformationsExternalDataSourcesAcl capability, and ExternalDataSourceIO resource handler. Feedback on the changes highlights an issue in ExternalDataSourceIO where self.client.tool is incorrectly used to access datasets instead of using self.client.data_sets directly.

Comment on lines +137 to +142
data_sets = self.client.tool.datasets.retrieve(
[ExternalId(external_id=data_set_external_id)], ignore_unknown_ids=True
)
if not data_sets:
raise ToolkitRequiredValueError(f"DataSet {data_set_external_id!r} does not exist")
data_set = data_sets[0]

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.

high

The self.client.tool object does not have a datasets attribute. Core CDF resources like datasets should be accessed directly via self.client.data_sets. Additionally, retrieving a single dataset by external ID can be simplified using self.client.data_sets.retrieve(external_id=...) which returns None if not found.

Suggested change
data_sets = self.client.tool.datasets.retrieve(
[ExternalId(external_id=data_set_external_id)], ignore_unknown_ids=True
)
if not data_sets:
raise ToolkitRequiredValueError(f"DataSet {data_set_external_id!r} does not exist")
data_set = data_sets[0]
data_set = self.client.data_sets.retrieve(external_id=data_set_external_id)
if not data_set:
raise ToolkitRequiredValueError(f"DataSet {data_set_external_id!r} does not exist")

Khyat-Cognite and others added 8 commits July 10, 2026 09:35
Only wire ExternalDataSourceIO via ext_onelake dependencies, scope dump to
referenced sources, exclude ACL from dataset_configurations until SDK ships,
and update complete_org loader coverage test.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove examples and integration test from the deploy PR branch; they
belong in the stacked docs PR.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use Sequence in the paginated return annotation so mypy does not resolve
list to the API method on Python 3.12.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add API client, ExternalDataSourceIO, ext_onelake() deploy ordering, dump
support, and unit tests. Skip auth/ACL checks when the capability is unavailable
or no resources are loaded.

Co-authored-by: Cursor <cursoragent@cursor.com>
Merge clean deploy restack with optional client_secret, auth
prerequisite_warning, and skip ACL validation when no resources are loaded.

Co-authored-by: Cursor <cursoragent@cursor.com>
Skip ExternalDataSourceIO in cdf auth required-capability checks because
transformationsExternalDataSourcesAcl is not yet in FlatCapabilities.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

☂️ Code Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
44336 38125 86% 80% 🟢

New Files

File Coverage Status
cognite_toolkit/_cdf_tk/client/api/transformation_external_data.py 70% 🟢
cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/external_data_source.py 76% 🟢
TOTAL 73% 🟢

Modified Files

File Coverage Status
cognite_toolkit/_cdf_tk/client/api/transformations.py 94% 🟢
cognite_toolkit/_cdf_tk/client/resource_classes/group/init.py 100% 🟢
cognite_toolkit/_cdf_tk/client/resource_classes/group/acls.py 99% 🟢
cognite_toolkit/_cdf_tk/client/testing.py 100% 🟢
cognite_toolkit/_cdf_tk/commands/auth.py 64% 🟢
cognite_toolkit/_cdf_tk/commands/dump_resource.py 78% 🟢
cognite_toolkit/_cdf_tk/resource_ios/init.py 82% 🟢
cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/init.py 100% 🟢
cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/transformation.py 83% 🟢
cognite_toolkit/_cdf_tk/resource_ios/_worker.py 95% 🟢
cognite_toolkit/_cdf_tk/utils/cdf.py 93% 🟢
TOTAL 90% 🟢

updated for commit: 7f04427 by action🐍

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.38095% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.99%. Comparing base (3a88cf6) to head (7f04427).

Files with missing lines Patch % Lines
...resource_ios/_resource_ios/external_data_source.py 76.47% 24 Missing ⚠️
..._cdf_tk/client/api/transformation_external_data.py 69.69% 10 Missing ⚠️
cognite_toolkit/_cdf_tk/commands/dump_resource.py 57.14% 3 Missing ⚠️
...df_tk/resource_ios/_resource_ios/transformation.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                         @@
##           feat/toolkit-onelake-edc-models    #3099      +/-   ##
===================================================================
- Coverage                            86.02%   85.99%   -0.04%     
===================================================================
  Files                                  477      479       +2     
  Lines                                44215    44336     +121     
===================================================================
+ Hits                                 38036    38125      +89     
- Misses                                6179     6211      +32     
Files with missing lines Coverage Δ
...nite_toolkit/_cdf_tk/client/api/transformations.py 93.87% <100.00%> (+0.26%) ⬆️
.../_cdf_tk/client/resource_classes/group/__init__.py 100.00% <ø> (ø)
...lkit/_cdf_tk/client/resource_classes/group/acls.py 98.76% <100.00%> (+0.01%) ⬆️
cognite_toolkit/_cdf_tk/client/testing.py 100.00% <100.00%> (ø)
cognite_toolkit/_cdf_tk/commands/auth.py 63.55% <100.00%> (+0.21%) ⬆️
cognite_toolkit/_cdf_tk/resource_ios/__init__.py 82.25% <ø> (ø)
...kit/_cdf_tk/resource_ios/_resource_ios/__init__.py 100.00% <100.00%> (ø)
cognite_toolkit/_cdf_tk/resource_ios/_worker.py 94.79% <100.00%> (+0.11%) ⬆️
cognite_toolkit/_cdf_tk/utils/cdf.py 93.37% <100.00%> (+0.14%) ⬆️
...df_tk/resource_ios/_resource_ios/transformation.py 82.81% <87.50%> (+0.04%) ⬆️
... and 3 more

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

Co-authored-by: Cursor <cursoragent@cursor.com>
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