Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create snowflake-devops-demo.yml #9

Closed
wants to merge 12 commits into from
41 changes: 41 additions & 0 deletions .github/workflows/snowflake-devops-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: snowflake-devops-demo

# Controls when the action will run.
on:
push:
branches:
- main
paths:
- 'migrations/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
deploy-snowflake-changes-job:
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v2
env:
SF_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SF_USERNAME: ${{ secrets.SNOWFLAKE_USERNAME }}
SF_ROLE: ${{ secrets.SNOWFLAKE_ROLE }}
SF_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }}
SF_DATABASE: ${{ secrets.SNOWFLAKE_DATABASE }}
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
- name: Use Python 3.8.x
uses: actions/[email protected]
with:
python-version: 3.8.x

run: |
echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
python --version
echo "Step 1: Installing schemachange"
pip install schemachange

echo "Step 2: Running schemachange"
schemachange -f $GITHUB_WORKSPACE/migrations -a $SF_ACCOUNT -u $SF_USERNAME -r $SF_ROLE -w $SF_WAREHOUSE -d $SF_DATABASE -c $SF_DATABASE.SCHEMACHANGE.CHANGE_HISTORY --create-change-history-table
8 changes: 8 additions & 0 deletions data/Migration/V1.1.1__initial_objects.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
USE DATABASE demo_db;
CREATE TABLE HELLO_WORLDDQ
(
FIRST_NAME VARCHAR
,LAST_NAME VARCHAR
,aDDRESS VARCHAR

);
2 changes: 2 additions & 0 deletions deploy_parametrized_pipeline.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
execute immediate from 'steps/01_setup_snowflake.sql' using (environment => '{{environment}}');
execute immediate from 'steps/03_harmonize_data.sql' using (environment => '{{environment}}');
execute immediate from 'steps/04_orchestrate_jobs.sql' using (environment => '{{environment}}', retention_time => {{retention_time}});

execute immediate from 'migration/V1.1.1__initial_objects.sql' using (environment => '{{environment}}');