Skip to content

Commit

Permalink
testing Matrix options for scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-tmathew committed May 6, 2024
1 parent 151ea37 commit 8655a50
Show file tree
Hide file tree
Showing 22 changed files with 114 additions and 40 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/dev-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
scenario-name: [ 'basics_demo', 'citibike_demo', 'citibike_demo_jinja']

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -61,9 +63,9 @@ jobs:
# echo "Tested SnowCLI connection successfully!"
# echo "Set default connection"
# snow --config-file config.toml connection set-default "myconnection"
- name: Test Basic Schemachange
- name: Test Schemachange - ${{ matrix.scenario-name }}
env:
SCENARIO_NAME: basics_demo
SCENARIO_NAME: ${{ matrix.scenario-name }}
run: |
export MY_TARGET_SCHEMA="${SCENARIO_NAME}_${{ env.SCHEMACHANGE_BUILD_ID }}"
echo "::group::Setting up ${MY_TARGET_SCHEMA}"
Expand Down
13 changes: 0 additions & 13 deletions demo/citibike/schemachange-config.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
-- Use Demo Database if it doesn't exist
USE DATABASE SCHEMACHANGE_DEMO;
-- Set the database and schema context
USE SCHEMA SCHEMACHANGE_DEMO.CITIBIKE_DEMO;
use database {{ database_name }};
use schema {{ schema_name }};

-- Create the file formats
CREATE OR REPLACE FILE FORMAT CSV_NO_HEADER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- Set the database and schema context
USE SCHEMA SCHEMACHANGE_DEMO.CITIBIKE_DEMO;
use database {{ database_name }};
use schema {{ schema_name }};

-- Load the trips data
-- Trips data bucket content has been updated.
Expand Down
17 changes: 17 additions & 0 deletions demo/citibike_demo/schemachange-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
config-version: 1

root-folder: ./demo/{{ env_var('SCENARIO_NAME')}}

snowflake-user: {{ env_var('SNOWFLAKE_USER')}}
snowflake-account: {{ env_var('SNOWFLAKE_ACCOUNT')}}
snowflake-role: {{ env_var('SNOWFLAKE_ROLE')}}
snowflake-warehouse: {{ env_var('SNOWFLAKE_WAREHOUSE')}}
snowflake-database: {{ env_var('SNOWFLAKE_DATABASE')}}
snowflake-schema: {{ env_var('MY_TARGET_SCHEMA')}}
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.{{ env_var('MY_TARGET_SCHEMA')}}.CHANGE_HISTORY"
create-change-history-table: true

vars:
database_name: {{env_var('SNOWFLAKE_DATABASE')}}
schema_name: {{env_var('MY_TARGET_SCHEMA')}}

File renamed without changes.
25 changes: 25 additions & 0 deletions demo/citibike_demo_jinja/schemachange-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
config-version: 1

root-folder: ./demo/{{ env_var('SCENARIO_NAME')}}/scripts
modules-folder: ./demo/{{ env_var('SCENARIO_NAME')}}/modules

snowflake-user: {{ env_var('SNOWFLAKE_USER')}}
snowflake-account: {{ env_var('SNOWFLAKE_ACCOUNT')}}
snowflake-role: {{ env_var('SNOWFLAKE_ROLE')}}
snowflake-warehouse: {{ env_var('SNOWFLAKE_WAREHOUSE')}}
snowflake-database: {{ env_var('SNOWFLAKE_DATABASE')}}
snowflake-schema: {{ env_var('MY_TARGET_SCHEMA')}}
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.{{ env_var('MY_TARGET_SCHEMA')}}.CHANGE_HISTORY"
create-change-history-table: true

vars:
database_name: {{env_var('SNOWFLAKE_DATABASE')}}
schema_name: {{env_var('MY_TARGET_SCHEMA')}}
secrets:
# not a good example of secrets, just here to demo the secret filtering
trips_s3_bucket: s3://snowflake-workshop-lab/citibike-trips
weather_s3_bucket: s3://snowflake-workshop-lab/weather-nyc




21 changes: 0 additions & 21 deletions demo/citibike_jinja/schemachange-config.yml

This file was deleted.

File renamed without changes.
16 changes: 16 additions & 0 deletions demo/setup/citibike_demo/schemachange-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
config-version: 1

root-folder: ./demo/setup/{{ env_var('SCENARIO_NAME')}}

snowflake-user: {{ env_var('SNOWFLAKE_USER')}}
snowflake-account: {{ env_var('SNOWFLAKE_ACCOUNT')}}
snowflake-role: {{ env_var('SNOWFLAKE_ROLE')}}
snowflake-warehouse: {{ env_var('SNOWFLAKE_WAREHOUSE')}}
snowflake-database: {{ env_var('SNOWFLAKE_DATABASE')}}
# tracking the setup step in a different change history table to use schemachange setup and teardown separate from deployment.
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.SCHEMACHANGE.{{ env_var('SCENARIO_NAME')}}_CHANGE_HISTORY"
create-change-history-table: true

vars:
database_name: {{env_var('SNOWFLAKE_DATABASE')}}
schema_name: {{env_var('MY_TARGET_SCHEMA')}}
16 changes: 16 additions & 0 deletions demo/setup/citibike_demo_jinja/schemachange-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
config-version: 1

root-folder: ./demo/setup/{{ env_var('SCENARIO_NAME')}}

snowflake-user: {{ env_var('SNOWFLAKE_USER')}}
snowflake-account: {{ env_var('SNOWFLAKE_ACCOUNT')}}
snowflake-role: {{ env_var('SNOWFLAKE_ROLE')}}
snowflake-warehouse: {{ env_var('SNOWFLAKE_WAREHOUSE')}}
snowflake-database: {{ env_var('SNOWFLAKE_DATABASE')}}
# tracking the setup step in a different change history table to use schemachange setup and teardown separate from deployment.
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.SCHEMACHANGE.{{ env_var('SCENARIO_NAME')}}_CHANGE_HISTORY"
create-change-history-table: true

vars:
database_name: {{env_var('SNOWFLAKE_DATABASE')}}
schema_name: {{env_var('MY_TARGET_SCHEMA')}}
16 changes: 16 additions & 0 deletions demo/teardown/citibike_demo/schemachange-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
config-version: 1

root-folder: ./demo/teardown/{{ env_var('SCENARIO_NAME')}}

snowflake-user: {{ env_var('SNOWFLAKE_USER')}}
snowflake-account: {{ env_var('SNOWFLAKE_ACCOUNT')}}
snowflake-role: {{ env_var('SNOWFLAKE_ROLE')}}
snowflake-warehouse: {{ env_var('SNOWFLAKE_WAREHOUSE')}}
snowflake-database: {{ env_var('SNOWFLAKE_DATABASE')}}
# tracking the setup step in a different change history table to use schemachange setup and teardown separate from deployment.
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.SCHEMACHANGE.{{ env_var('SCENARIO_NAME')}}_CHANGE_HISTORY"
create-change-history-table: true

vars:
database_name: {{env_var('SNOWFLAKE_DATABASE')}}
schema_name: {{env_var('MY_TARGET_SCHEMA')}}
16 changes: 16 additions & 0 deletions demo/teardown/citibike_demo_jinja/schemachange-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
config-version: 1

root-folder: ./demo/teardown/{{ env_var('SCENARIO_NAME')}}

snowflake-user: {{ env_var('SNOWFLAKE_USER')}}
snowflake-account: {{ env_var('SNOWFLAKE_ACCOUNT')}}
snowflake-role: {{ env_var('SNOWFLAKE_ROLE')}}
snowflake-warehouse: {{ env_var('SNOWFLAKE_WAREHOUSE')}}
snowflake-database: {{ env_var('SNOWFLAKE_DATABASE')}}
# tracking the setup step in a different change history table to use schemachange setup and teardown separate from deployment.
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.SCHEMACHANGE.{{ env_var('SCENARIO_NAME')}}_CHANGE_HISTORY"
create-change-history-table: true

vars:
database_name: {{env_var('SNOWFLAKE_DATABASE')}}
schema_name: {{env_var('MY_TARGET_SCHEMA')}}

0 comments on commit 8655a50

Please sign in to comment.