Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5fa1dad
managed
Suresh-Tamang May 15, 2026
66af34e
create main.yml
Suresh-Tamang May 24, 2026
e2da077
Merge pull request #1 from Suresh-Tamang/Suresh-Tamang-patch-1
Suresh-Tamang May 24, 2026
32fe065
Merge pull request #2 from Suresh-Tamang/Suresh-Tamang-patch-1
Suresh-Tamang May 24, 2026
7881d8f
Merge pull request #3 from Suresh-Tamang/staging
Suresh-Tamang May 24, 2026
51f8a4c
Merge pull request #4 from Suresh-Tamang/fix-missing-data
Suresh-Tamang May 24, 2026
7d82348
Update deployment command to use dynamic branch name
Suresh-Tamang May 24, 2026
8a9aeef
Merge pull request #5 from Suresh-Tamang/Suresh-Tamang-patch-1
Suresh-Tamang May 24, 2026
1932b1f
Merge pull request #6 from Suresh-Tamang/Suresh-Tamang-patch-1
Suresh-Tamang May 24, 2026
32f064f
Refactor deployment workflow for Hamburg weather
Suresh-Tamang May 24, 2026
f3e770e
Merge pull request #7 from Suresh-Tamang/Suresh-Tamang-patch-1
Suresh-Tamang May 24, 2026
8354716
Update main.yml
Suresh-Tamang May 24, 2026
af13ba2
Update main.yml
Suresh-Tamang May 24, 2026
ab36024
Update GitHub Actions workflow for deployment logic
Suresh-Tamang May 24, 2026
758d05a
Merge pull request #8 from Suresh-Tamang/staging
Suresh-Tamang May 24, 2026
0b6ecba
Delete module-1/hamburg_weather/main.yml
Suresh-Tamang May 24, 2026
b041123
Delete .github/workflows/main.yml
Suresh-Tamang May 24, 2026
297d25f
Add GitHub Actions workflow for data environment deployment
Suresh-Tamang May 24, 2026
0e09781
Merge pull request #9 from Suresh-Tamang/Suresh-Tamang-patch-1
Suresh-Tamang May 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions module-1/hamburg_weather/main.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,66 @@ on:
branches:
- staging
- main

push:
branches:
- staging
- main

jobs:
deploy_data_environment:
# Only run when PR is merged or on direct push to environment branches
# Run on push OR merged PR
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
# Determine deployment environment + branch
- name: Set environment
id: set_env
run: |
TARGET_BRANCH="${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}"

if [[ $TARGET_BRANCH == "staging" ]]; then

echo "TARGET_BRANCH=$TARGET_BRANCH" >> $GITHUB_ENV

if [[ "$TARGET_BRANCH" == "staging" ]]; then
echo "DEPLOY_ENV=staging" >> $GITHUB_ENV
echo "Environment set to staging"
elif [[ $TARGET_BRANCH == "main" ]]; then

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
- name: Install Snowflake CLI
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
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/FIX-ME/module-1/hamburg_weather/pipeline/data/ \
-D "env='${{ }}'" \
--database=COURSE_REPO \
--schema=PUBLIC
echo "Deploying branch: ${TARGET_BRANCH}"
echo "Deploy environment: ${DEPLOY_ENV}"

snow git execute \
@advanced_data_engineering_snowflake/branches/${TARGET_BRANCH}/module-1/hamburg_weather/pipeline/data/ \
-D "env='${DEPLOY_ENV}'" \
--database=COURSE_REPO \
--schema=PUBLIC
27 changes: 14 additions & 13 deletions module-1/hamburg_weather/pipeline/data/load_tasty_bytes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ raw zone table build
-- country table build

-- todo: complete table build
CREATE TABLE {{env}}_tasty_bytes.raw_pos.country
CREATE OR ALTER TABLE {{env}}_tasty_bytes.raw_pos.country
(
country_id NUMBER(18,0),
country VARCHAR(16777216),
iso_currency VARCHAR(3),
iso_country VARCHAR(2),
city VARCHAR(16777216),
city_population VARCHAR(16777216)
city_population VARCHAR(16777216),
city_id NUMBER(38,0)
);


Expand Down Expand Up @@ -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
Expand Down