diff --git a/.github/workflows/snowflake-devops-demo.yml b/.github/workflows/snowflake-devops-demo.yml new file mode 100644 index 0000000..e93dccc --- /dev/null +++ b/.github/workflows/snowflake-devops-demo.yml @@ -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/setup-python@v2.2.1 + 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 diff --git a/data/Migration/V1.1.1__initial_objects.sql b/data/Migration/V1.1.1__initial_objects.sql new file mode 100644 index 0000000..74fd4ef --- /dev/null +++ b/data/Migration/V1.1.1__initial_objects.sql @@ -0,0 +1,8 @@ +USE DATABASE demo_db; +CREATE TABLE HELLO_WORLDDQ +( + FIRST_NAME VARCHAR + ,LAST_NAME VARCHAR + ,aDDRESS VARCHAR + +); \ No newline at end of file diff --git a/deploy_parametrized_pipeline.sql b/deploy_parametrized_pipeline.sql index 9fe030f..f6f1328 100644 --- a/deploy_parametrized_pipeline.sql +++ b/deploy_parametrized_pipeline.sql @@ -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}}'); \ No newline at end of file