From 151ea37002be467adb169efeb023ce187b5633e8 Mon Sep 17 00:00:00 2001 From: Tiji Mathew Date: Mon, 6 May 2024 14:25:32 -0400 Subject: [PATCH] parameterizing the basics Demo --- .github/workflows/dev-pytest.yml | 20 +++++++++++-------- demo/{basics => basics_demo}/A__basic001.sql | 0 demo/{basics => basics_demo}/R__basic001.sql | 0 .../V1.0.0__basic001.sql | 0 .../schemachange-config.yml | 2 +- .../setup/basics_demo/schemachange-config.yml | 5 +++-- .../basics_demo/schemachange-config.yml | 5 +++-- 7 files changed, 19 insertions(+), 13 deletions(-) rename demo/{basics => basics_demo}/A__basic001.sql (100%) rename demo/{basics => basics_demo}/R__basic001.sql (100%) rename demo/{basics => basics_demo}/V1.0.0__basic001.sql (100%) rename demo/{basics => basics_demo}/schemachange-config.yml (92%) diff --git a/.github/workflows/dev-pytest.yml b/.github/workflows/dev-pytest.yml index c39b7429..2e47ddf1 100644 --- a/.github/workflows/dev-pytest.yml +++ b/.github/workflows/dev-pytest.yml @@ -63,16 +63,20 @@ jobs: # snow --config-file config.toml connection set-default "myconnection" - name: Test Basic Schemachange env: - MY_TARGET_SCHEMA: BASICS_DEMO_${{ env.SCHEMACHANGE_BUILD_ID }} + SCENARIO_NAME: basics_demo run: | - echo "Setting up ${MY_TARGET_SCHEMA}" - schemachange --config-folder ./demo/setup/basics_demo + export MY_TARGET_SCHEMA="${SCENARIO_NAME}_${{ env.SCHEMACHANGE_BUILD_ID }}" + echo "::group::Setting up ${MY_TARGET_SCHEMA}" + schemachange --config-folder ./demo/setup/${SCENARIO_NAME} + echo "::endgroup::" echo "Testing Rendering to ${MY_TARGET_SCHEMA}" - echo "Work in Progress" - echo "Testing Deployment using ${MY_TARGET_SCHEMA}" - schemachange --config-folder ./demo/basics - echo "Tearing down up ${MY_TARGET_SCHEMA}" - schemachange --config-folder ./demo/teardown/basics_demo + echo "Work in Progress - To be Tested" + echo "::group::Testing Deployment using ${MY_TARGET_SCHEMA}" + schemachange --config-folder ./demo/${SCENARIO_NAME} + echo "::endgroup::" + echo "::group::Tearing down up ${MY_TARGET_SCHEMA}" + schemachange --config-folder ./demo/teardown/${SCENARIO_NAME} + echo "::endgroup::" #- name: Test Citibike Demo # run: | # snow --config-file config.toml sql -f ./demo/setup/setup_citibike_demo.sql diff --git a/demo/basics/A__basic001.sql b/demo/basics_demo/A__basic001.sql similarity index 100% rename from demo/basics/A__basic001.sql rename to demo/basics_demo/A__basic001.sql diff --git a/demo/basics/R__basic001.sql b/demo/basics_demo/R__basic001.sql similarity index 100% rename from demo/basics/R__basic001.sql rename to demo/basics_demo/R__basic001.sql diff --git a/demo/basics/V1.0.0__basic001.sql b/demo/basics_demo/V1.0.0__basic001.sql similarity index 100% rename from demo/basics/V1.0.0__basic001.sql rename to demo/basics_demo/V1.0.0__basic001.sql diff --git a/demo/basics/schemachange-config.yml b/demo/basics_demo/schemachange-config.yml similarity index 92% rename from demo/basics/schemachange-config.yml rename to demo/basics_demo/schemachange-config.yml index a61a0d26..ec688e66 100644 --- a/demo/basics/schemachange-config.yml +++ b/demo/basics_demo/schemachange-config.yml @@ -1,6 +1,6 @@ config-version: 1 -root-folder: ./demo/basics +root-folder: ./demo/{{ env_var('SCENARIO_NAME')}} snowflake-user: {{ env_var('SNOWFLAKE_USER')}} snowflake-account: {{ env_var('SNOWFLAKE_ACCOUNT')}} diff --git a/demo/setup/basics_demo/schemachange-config.yml b/demo/setup/basics_demo/schemachange-config.yml index 99195de0..126b7ae7 100644 --- a/demo/setup/basics_demo/schemachange-config.yml +++ b/demo/setup/basics_demo/schemachange-config.yml @@ -1,13 +1,14 @@ config-version: 1 -root-folder: ./demo/setup/basics_demo +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')}} -change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.SCHEMACHANGE.BASICS_DEMO_CHANGE_HISTORY" +# 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: diff --git a/demo/teardown/basics_demo/schemachange-config.yml b/demo/teardown/basics_demo/schemachange-config.yml index 0f06ae9f..74e4ffc5 100644 --- a/demo/teardown/basics_demo/schemachange-config.yml +++ b/demo/teardown/basics_demo/schemachange-config.yml @@ -1,13 +1,14 @@ config-version: 1 -root-folder: ./demo/teardown/basics_demo +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')}} -change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.SCHEMACHANGE.BASICS_DEMO_CHANGE_HISTORY" +# 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: