-
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] Use Sigma translator instance in spec loader and stat…
…e-backed defs
- Loading branch information
1 parent
3b8f8e8
commit 926c8de
Showing
4 changed files
with
79 additions
and
21 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
33 changes: 33 additions & 0 deletions
33
...odules/libraries/dagster-sigma/dagster_sigma_tests/pending_repo_with_translator_legacy.py
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from dagster import EnvVar, define_asset_job | ||
from dagster._core.definitions.asset_spec import AssetSpec | ||
from dagster._core.definitions.definitions_class import Definitions | ||
from dagster._utils.env import environ | ||
from dagster_sigma import ( | ||
DagsterSigmaTranslator, | ||
SigmaBaseUrl, | ||
SigmaOrganization, | ||
load_sigma_asset_specs, | ||
) | ||
|
||
fake_client_id = "fake_client_id" | ||
fake_client_secret = "fake_client_secret" | ||
|
||
with environ({"SIGMA_CLIENT_ID": fake_client_id, "SIGMA_CLIENT_SECRET": fake_client_secret}): | ||
fake_token = "fake_token" | ||
|
||
class MyCoolTranslator(DagsterSigmaTranslator): | ||
def get_asset_spec(self, data) -> AssetSpec: | ||
spec = super().get_asset_spec(data) | ||
return spec.replace_attributes( | ||
key=spec.key.with_prefix("my_prefix"), | ||
) | ||
|
||
resource = SigmaOrganization( | ||
base_url=SigmaBaseUrl.AWS_US, | ||
client_id=EnvVar("SIGMA_CLIENT_ID"), | ||
client_secret=EnvVar("SIGMA_CLIENT_SECRET"), | ||
) | ||
|
||
# Pass the translator type | ||
sigma_specs = load_sigma_asset_specs(resource, dagster_sigma_translator=MyCoolTranslator) | ||
defs = Definitions(assets=[*sigma_specs], jobs=[define_asset_job("all_asset_job")]) |
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