-
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.
[docs] Add tested snippets to embedded-elt
## Summary & Motivation This fixes some formatting issues in a Python code block and uses snippets for the code blocks in the example
- Loading branch information
1 parent
f46a70a
commit 1983c75
Showing
9 changed files
with
146 additions
and
13 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Empty file.
42 changes: 42 additions & 0 deletions
42
examples/docs_snippets/docs_snippets/integrations/embedded_elt/postgres_snowflake.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,42 @@ | ||
# pyright: reportGeneralTypeIssues=none | ||
# pyright: reportOptionalMemberAccess=none | ||
|
||
import os | ||
|
||
from dagster_embedded_elt.sling import ( | ||
SlingMode, | ||
SlingResource, | ||
SlingSourceConnection, | ||
SlingTargetConnection, | ||
build_sling_asset, | ||
) | ||
|
||
from dagster import AssetSpec | ||
|
||
source = SlingSourceConnection( | ||
type="postgres", | ||
host="localhost", | ||
port=5432, | ||
database="my_database", | ||
user="my_user", | ||
password=os.getenv("PG_PASS"), | ||
) | ||
|
||
target = SlingTargetConnection( | ||
type="snowflake", | ||
host="hostname.snowflake", | ||
user="username", | ||
database="database", | ||
password=os.getenv("SF_PASSWORD"), | ||
role="role", | ||
) | ||
|
||
sling = SlingResource(source_connection=source, target_connection=target) | ||
|
||
asset_def = build_sling_asset( | ||
asset_spec=AssetSpec("my_asset_name"), | ||
source_stream="public.my_table", | ||
target_object="marts.my_table", | ||
mode=SlingMode.INCREMENTAL, | ||
primary_key="id", | ||
) |
42 changes: 42 additions & 0 deletions
42
examples/docs_snippets/docs_snippets/integrations/embedded_elt/s3_snowflake.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,42 @@ | ||
# pyright: reportGeneralTypeIssues=none | ||
# pyright: reportOptionalMemberAccess=none | ||
|
||
import os | ||
|
||
from dagster_embedded_elt.sling import ( | ||
SlingResource, | ||
SlingSourceConnection, | ||
SlingTargetConnection, | ||
build_sling_asset, | ||
) | ||
|
||
from dagster import AssetSpec | ||
|
||
target = SlingTargetConnection( | ||
type="snowflake", | ||
host="hostname.snowflake", | ||
user="username", | ||
database="database", | ||
password=os.getenv("SF_PASSWORD"), | ||
role="role", | ||
) | ||
|
||
|
||
# start_storage_config | ||
source = SlingSourceConnection( | ||
type="s3", | ||
bucket="sling-bucket", | ||
access_key_id=os.getenv("AWS_ACCESS_KEY_ID"), | ||
secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"), | ||
) | ||
|
||
sling = SlingResource(source_connection=source, target_connection=target) | ||
|
||
asset_def = build_sling_asset( | ||
asset_spec=AssetSpec("my_asset_name"), | ||
source_stream="s3://my-bucket/my_file.parquet", | ||
target_object="marts.my_table", | ||
primary_key="id", | ||
) | ||
|
||
# end_storage_config |
11 changes: 11 additions & 0 deletions
11
examples/docs_snippets/docs_snippets_tests/integrations_tests/test_embedded_elt.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,11 @@ | ||
from docs_snippets.integrations.embedded_elt.postgres_snowflake import ( | ||
asset_def as asset_def_postgres, | ||
) | ||
from docs_snippets.integrations.embedded_elt.s3_snowflake import ( | ||
asset_def as asset_def_s3, | ||
) | ||
|
||
|
||
def test_asset_defs(): | ||
assert asset_def_postgres | ||
assert asset_def_s3 |
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
2 changes: 1 addition & 1 deletion
2
examples/project_fully_featured/dbt_project/target/manifest.json
Large diffs are not rendered by default.
Oops, something went wrong.
1983c75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for dagster-docs ready!
✅ Preview
https://dagster-docs-h71y1j3ob-elementl.vercel.app
https://master.dagster.dagster-docs.io
Built with commit 1983c75.
This pull request is being automatically deployed with vercel-action