-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* created a separate code location for snowflake_insights * updated _process_partitioned_dbt_assets function to incorporate snowflake_insights functionality * added missing dependencies added missing comma added gql dependency add missing import * add missing deps * added missing deps * Update Dockerfile fix libcrytpo --------- Co-authored-by: Sean Lopp <[email protected]>
- Loading branch information
Showing
9 changed files
with
127 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,22 @@ jobs: | |
with: | ||
command: "ci set-build-output --location-name=batch_enrichment --image-tag=$IMAGE_TAG-batch-enrichment" | ||
|
||
# Build 'snowflake_insights' code location | ||
- name: Build and upload Docker image for snowflake insights | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./hooli_snowflake_insights | ||
push: true | ||
tags: ${{ env.IMAGE_REGISTRY }}:${{ env.IMAGE_TAG }}-snowflake-insights | ||
|
||
- name: Update build session with image tag for snowflake insights | ||
id: ci-set-build-output-snowflake-insights | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected] | ||
with: | ||
command: "ci set-build-output --location-name=snowflake_insights --image-tag=$IMAGE_TAG-snowflake-insights" | ||
|
||
# Deploy | ||
- name: Deploy to Dagster Cloud | ||
id: ci-deploy | ||
|
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM python:3.10-slim | ||
|
||
WORKDIR /opt/dagster/app | ||
|
||
RUN apt-get update && apt-get install -y git | ||
|
||
RUN python -m pip uninstall oscrypto -y | ||
RUN python -m pip install git+https://github.com/wbond/oscrypto.git@d5f3437ed24257895ae1edd9e503cfb352e635a8 | ||
|
||
ADD . . | ||
|
||
RUN pip install -r requirements.txt |
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,48 @@ | ||
import os | ||
|
||
from dagster import Definitions, EnvVar, ResourceDefinition | ||
from dagster_cloud.dagster_insights import ( | ||
create_snowflake_insights_asset_and_schedule, | ||
) | ||
from dagster_snowflake import SnowflakeResource | ||
|
||
# Used to derive environment (LOCAL, BRANCH, PROD) | ||
def get_env(): | ||
if os.getenv("DAGSTER_CLOUD_IS_BRANCH_DEPLOYMENT", "") == "1": | ||
return "BRANCH" | ||
if os.getenv("DAGSTER_CLOUD_DEPLOYMENT_NAME", "") == "data-eng-prod": | ||
return "PROD" | ||
return "LOCAL" | ||
|
||
# Setting connection details by environment | ||
resource_def = { | ||
"LOCAL": { | ||
"snowflake_insights": ResourceDefinition.none_resource(), | ||
}, | ||
"BRANCH": { | ||
"snowflake_insights": SnowflakeResource( | ||
account=EnvVar("SNOWFLAKE_ACCOUNT"), | ||
user=EnvVar("SNOWFLAKE_USER"), | ||
password=EnvVar("SNOWFLAKE_PASSWORD"), | ||
), | ||
}, | ||
"PROD": { | ||
"snowflake_insights": SnowflakeResource( | ||
account=EnvVar("SNOWFLAKE_ACCOUNT"), | ||
user=EnvVar("SNOWFLAKE_USER"), | ||
password=EnvVar("SNOWFLAKE_PASSWORD"), | ||
), | ||
}, | ||
} | ||
|
||
# Creates an asset (poll_snowflake_query_history_hour) and sets its schedule | ||
snowflake_insights_definitions = create_snowflake_insights_asset_and_schedule( | ||
"2023-10-29-00:00", | ||
snowflake_resource_key="snowflake_insights", | ||
) | ||
|
||
defs = Definitions( | ||
assets=[*snowflake_insights_definitions.assets,], | ||
schedules=[snowflake_insights_definitions.schedule,], | ||
resources=resource_def[get_env()], | ||
) |
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,6 @@ | ||
dagster | ||
dagster-cloud | ||
dagster-dbt | ||
dagster-snowflake | ||
gql | ||
requests_toolbelt |
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 |
---|---|---|
|
@@ -43,4 +43,6 @@ | |
dbt-duckdb | ||
responses | ||
plotnine | ||
requests | ||
requests | ||
gql | ||
requests_toolbelt |
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