-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dagster-sigma] Add support for direct workbook->table deps (#25991)
## Summary Sigma workbooks typically depend on datasets, which passthrough data from a database to structured tables that users can refresh or rename. However, you can also point workbooks directly at tables in your warehouse. This PR allows our integration to be aware of the latter, creating upstream external assets for each table. ## Test Plan Update unit test, test locally against real Sigma instance. ## Changelog > [dagster-sigma] Added support for direct workbook->warehouse table dependencies.
- Loading branch information
Showing
4 changed files
with
126 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,15 @@ | |
DagsterSigmaTranslator, | ||
SigmaDataset, | ||
SigmaOrganizationData, | ||
SigmaTable, | ||
SigmaWorkbook, | ||
) | ||
|
||
from dagster_sigma_tests.conftest import ( | ||
SAMPLE_DATASET_DATA, | ||
SAMPLE_DATASET_INODE, | ||
SAMPLE_TABLE_DATA, | ||
SAMPLE_TABLE_INODE, | ||
SAMPLE_WORKBOOK_DATA, | ||
) | ||
|
||
|
@@ -21,12 +24,17 @@ def test_workbook_translation() -> None: | |
properties=SAMPLE_WORKBOOK_DATA, | ||
datasets={SAMPLE_DATASET_INODE}, | ||
owner_email="[email protected]", | ||
direct_table_deps={SAMPLE_TABLE_INODE}, | ||
) | ||
|
||
sample_dataset = SigmaDataset(properties=SAMPLE_DATASET_DATA, columns=set(), inputs=set()) | ||
|
||
translator = DagsterSigmaTranslator( | ||
SigmaOrganizationData(workbooks=[sample_workbook], datasets=[sample_dataset]) | ||
SigmaOrganizationData( | ||
workbooks=[sample_workbook], | ||
datasets=[sample_dataset], | ||
tables=[SigmaTable(properties=SAMPLE_TABLE_DATA)], | ||
) | ||
) | ||
|
||
asset_spec = translator.get_asset_spec(sample_workbook) | ||
|
@@ -36,8 +44,11 @@ def test_workbook_translation() -> None: | |
assert asset_spec.metadata["dagster_sigma/version"] == 5 | ||
assert asset_spec.metadata["dagster_sigma/created_at"].value == 1726176169.072 | ||
assert build_kind_tag_key("sigma") in asset_spec.tags | ||
assert {dep.asset_key for dep in asset_spec.deps} == {AssetKey(["Orders_Dataset"])} | ||
assert asset_spec.owners == ["[email protected]"] | ||
assert {dep.asset_key for dep in asset_spec.deps} == { | ||
AssetKey(["Orders_Dataset"]), | ||
AssetKey(["my_database", "my_schema", "payments"]), | ||
} | ||
|
||
|
||
def test_dataset_translation() -> None: | ||
|
@@ -48,7 +59,7 @@ def test_dataset_translation() -> None: | |
) | ||
|
||
translator = DagsterSigmaTranslator( | ||
SigmaOrganizationData(workbooks=[], datasets=[sample_dataset]) | ||
SigmaOrganizationData(workbooks=[], datasets=[sample_dataset], tables=[]) | ||
) | ||
|
||
asset_spec = translator.get_asset_spec(sample_dataset) | ||
|
@@ -89,7 +100,9 @@ def get_asset_spec(self, data: SigmaDataset) -> AssetSpec: | |
inputs={"TESTDB.JAFFLE_SHOP.STG_ORDERS"}, | ||
) | ||
|
||
translator = MyCustomTranslator(SigmaOrganizationData(workbooks=[], datasets=[sample_dataset])) | ||
translator = MyCustomTranslator( | ||
SigmaOrganizationData(workbooks=[], datasets=[sample_dataset], tables=[]) | ||
) | ||
|
||
asset_spec = translator.get_asset_spec(sample_dataset) | ||
|
||
|