From 8bb18dabf9f82383b77ab111394d55945a3e952f Mon Sep 17 00:00:00 2001 From: Mubasher Aslam Date: Sun, 1 Mar 2026 09:17:58 +0400 Subject: [PATCH 1/6] Update README.md repo name updated, was referring to the wrong one. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d03450e..ce3fd7e6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ To successfully follow along with the instructor during the course, you'll need 2. Clone your fork: ```bash -git clone https://github.com//modern-data-engineering-snowflake.git +git clone https://github.com//advanced-data-engineering-snowflake.git ``` Where `` is replaced by your GitHub user name. This workflow is covered in the course. From fdbfb9d8868136806ffb6d75a202f20b8e85fa1b Mon Sep 17 00:00:00 2001 From: Mubasher Aslam Date: Sun, 1 Mar 2026 10:44:14 +0400 Subject: [PATCH 2/6] Update views.sql --- module-1/hamburg_weather/pipeline/objects/views/views.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module-1/hamburg_weather/pipeline/objects/views/views.sql b/module-1/hamburg_weather/pipeline/objects/views/views.sql index a0f9d593..7888d2ed 100644 --- a/module-1/hamburg_weather/pipeline/objects/views/views.sql +++ b/module-1/hamburg_weather/pipeline/objects/views/views.sql @@ -7,8 +7,8 @@ SELECT TO_VARCHAR(hd.date_valid_std, 'YYYY-MM') AS yyyy_mm, pc.city_name AS city, c.country AS country_desc -FROM WEATHER_SOURCE_LLC_FROSTBYTE.onpoint_id.history_day hd -JOIN WEATHER_SOURCE_LLC_FROSTBYTE.onpoint_id.postal_codes pc +FROM FROSTBYTE_WEATHERSOURCE.onpoint_id.history_day hd +JOIN FROSTBYTE_WEATHERSOURCE.onpoint_id.postal_codes pc ON pc.postal_code = hd.postal_code AND pc.country = hd.country JOIN {{env}}_tasty_bytes.raw_pos.country c From 89e129ed02b1f496a4409b51336e53e90904176b Mon Sep 17 00:00:00 2001 From: Mubasher Aslam Date: Sun, 1 Mar 2026 11:27:23 +0400 Subject: [PATCH 3/6] Update load_tasty_bytes.sql country table fixed and copy command uncommented --- .../pipeline/data/load_tasty_bytes.sql | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/module-1/hamburg_weather/pipeline/data/load_tasty_bytes.sql b/module-1/hamburg_weather/pipeline/data/load_tasty_bytes.sql index 4565f538..fa1170cf 100644 --- a/module-1/hamburg_weather/pipeline/data/load_tasty_bytes.sql +++ b/module-1/hamburg_weather/pipeline/data/load_tasty_bytes.sql @@ -64,7 +64,8 @@ CREATE TABLE {{env}}_tasty_bytes.raw_pos.country iso_currency VARCHAR(3), iso_country VARCHAR(2), city VARCHAR(16777216), - city_population VARCHAR(16777216) + city_population VARCHAR(16777216), + city_id NUMBER(19,0) ); @@ -293,17 +294,17 @@ USE WAREHOUSE demo_build_wh; -- country table load --- COPY INTO {{env}}_tasty_bytes.raw_pos.country --- ( --- country_id, --- country, --- iso_currency, --- iso_country, --- city_id, --- city, --- city_population --- ) --- FROM @{{env}}_tasty_bytes.public.s3load/raw_pos/country/; + COPY INTO {{env}}_tasty_bytes.raw_pos.country + ( + country_id, + country, + iso_currency, + iso_country, + city_id, + city, + city_population + ) + FROM @{{env}}_tasty_bytes.public.s3load/raw_pos/country/; -- franchise table load @@ -338,4 +339,4 @@ FROM @{{env}}_tasty_bytes.public.s3load/raw_pos/subset_order_header/; -- order_detail table load COPY INTO {{env}}_tasty_bytes.raw_pos.order_detail -FROM @{{env}}_tasty_bytes.public.s3load/raw_pos/subset_order_detail/; \ No newline at end of file +FROM @{{env}}_tasty_bytes.public.s3load/raw_pos/subset_order_detail/; From 4088872e93e54aca3121c103e458eadeec7a48e1 Mon Sep 17 00:00:00 2001 From: Mubasher Aslam Date: Sun, 1 Mar 2026 15:23:21 +0400 Subject: [PATCH 4/6] Create main.yml --- .github/workflows/main.yml | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..e7413e0c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,67 @@ +name: Deploy Templatized Data Environment + +on: + pull_request: + types: [closed] + branches: + - staging + - main + push: + branches: + - staging + - main + +jobs: + deploy_data_environment: + # Only run when PR is merged or on direct push to environment branches + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) + runs-on: ubuntu-latest + + env: + # Read connection secret + SNOWFLAKE_CONNECTIONS_ADVANCED_DATA_ENGINEERING_SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} + SNOWFLAKE_CONNECTIONS_ADVANCED_DATA_ENGINEERING_SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }} + SNOWFLAKE_CONNECTIONS_ADVANCED_DATA_ENGINEERING_SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} + + steps: + # Checkout step is necessary to access repository files + - name: Checkout repository + uses: actions/checkout@v4 + + # Determine environment based on target branch + - name: Set environment + id: set_env + run: | + TARGET_BRANCH="${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}" + + if [[ $TARGET_BRANCH == "staging" ]]; then + echo "DEPLOY_ENV=staging" >> $GITHUB_ENV + echo "Environment set to staging" + elif [[ $TARGET_BRANCH == "main" ]]; then + echo "DEPLOY_ENV=prod" >> $GITHUB_ENV + echo "Environment set to production" + else + echo "Unexpected branch: $TARGET_BRANCH" + exit 1 + fi + + # Install Snowflake CLI GitHub Action and point to config file + - name: Install SnowflakeCLI + uses: snowflakedb/snowflake-cli-action@v1.5 + with: + cli-version: "latest" + default-config-file-path: "config.toml" + + # Fetch latest changes from the repository to Snowflake + - name: Fetch latest changes to Snowflake + run: snow git fetch course_repo.public.advanced_data_engineering_snowflake + + # Deploy templates to the data environment - + - name: Deploy templates to data environment + run: | + # Export TARGET_BRANCH for use in this step + echo "Using branch: ${GITHUB_REF_NAME}" + snow git execute @advanced_data_engineering_snowflake/branches/${GITHUB_REF_NAME}/module-1/hamburg_weather/pipeline/data/ \ + -D "env='${{ env.DEPLOY_ENV }}'" \ + --database=COURSE_REPO \ + --schema=PUBLIC From dbf55b54d3cf2b3bbc678a59006c0a6c23078f02 Mon Sep 17 00:00:00 2001 From: Mubasher Aslam Date: Sun, 1 Mar 2026 15:36:37 +0400 Subject: [PATCH 5/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce3fd7e6..95260d49 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ To successfully follow along with the instructor during the course, you'll need 1. Fork the repo to create a copy associated with your GitHub Account: https://github.com/Snowflake-Labs/advanced-data-engineering-snowflake/fork -2. Clone your fork: +2. Clone your fork FIXED: ```bash git clone https://github.com//advanced-data-engineering-snowflake.git From 6f849a78c2f3eee46219c327f9959933360903ce Mon Sep 17 00:00:00 2001 From: Mubasher Aslam Date: Sun, 1 Mar 2026 15:37:14 +0400 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce3fd7e6..49cd9f9b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ To successfully follow along with the instructor during the course, you'll need 1. Fork the repo to create a copy associated with your GitHub Account: https://github.com/Snowflake-Labs/advanced-data-engineering-snowflake/fork -2. Clone your fork: +2. Clone your fork Fixed one: ```bash git clone https://github.com//advanced-data-engineering-snowflake.git