diff --git a/.github/workflows/dbt-ci.yml b/.github/workflows/dbt-ci.yml index 592773c..f3ad0f4 100644 --- a/.github/workflows/dbt-ci.yml +++ b/.github/workflows/dbt-ci.yml @@ -16,6 +16,10 @@ jobs: env: DBT_PRIVATE_KEY: ${{ secrets.DBT_PRIVATE_KEY }} DBT_PRIVATE_KEY_PATH: /home/runner/.dbt/rsa_key.p8 + DBT_SNOWFLAKE_ACCOUNT: ${{ secrets.DBT_SNOWFLAKE_ACCOUNT }} + DBT_SNOWFLAKE_ROLE: ${{ secrets.DBT_SNOWFLAKE_ROLE }} + DBT_SNOWFLAKE_USER: ${{ secrets.DBT_SNOWFLAKE_USER }} + DBT_SCHEMA: pr_${{ github.event.pull_request.number }}_ANALYTICS steps: - name: Checkout repo @@ -42,7 +46,7 @@ jobs: run: dbt deps - name: Run dbt debug - run: dbt debug --target ci + run: dbt debug --target ci - name: Run dbt run: dbt build --target ci \ No newline at end of file diff --git a/marketing_insights/.dbt/profiles.yml b/marketing_insights/.dbt/profiles.yml index b9a310f..3fbd8c6 100644 --- a/marketing_insights/.dbt/profiles.yml +++ b/marketing_insights/.dbt/profiles.yml @@ -1,13 +1,13 @@ marketing_insights: outputs: ci: - account: EBIUGTJ-FN06775 + account: "{{ env_var('DBT_SNOWFLAKE_ACCOUNT') }}" database: MARKETING_INSIGHTS_CI private_key_path: "{{ env_var('DBT_PRIVATE_KEY_PATH') }}" - role: ACCOUNTADMIN - schema: ANALYTICS_CI + role: "{{ env_var('DBT_SNOWFLAKE_ROLE') }}" + schema: "{{ env_var('DBT_SCHEMA') }}" threads: 1 type: snowflake - user: KIRANPOTHINA + user: "{{ env_var('DBT_SNOWFLAKE_USER') }}" warehouse: COMPUTE_WH target: ci \ No newline at end of file diff --git a/marketing_insights/dbt_project.yml b/marketing_insights/dbt_project.yml index 582ee16..98b19be 100644 --- a/marketing_insights/dbt_project.yml +++ b/marketing_insights/dbt_project.yml @@ -52,6 +52,11 @@ models: +schema: MART +meta: layer: gold + reporting: + +tags: ['business intelligence', 'gold'] + +schema: REPORTING + +meta: + layer: gold example: +materialized: view diff --git a/marketing_insights/models/example/my_first_dbt_model.sql b/marketing_insights/models/example/my_first_dbt_model.sql deleted file mode 100644 index f31a12d..0000000 --- a/marketing_insights/models/example/my_first_dbt_model.sql +++ /dev/null @@ -1,27 +0,0 @@ - -/* - Welcome to your first dbt model! - Did you know that you can also configure models directly within SQL files? - This will override configurations stated in dbt_project.yml - - Try changing "table" to "view" below -*/ - -{{ config(materialized='table') }} - -with source_data as ( - - select 1 as id - union all - select null as id - -) - -select * -from source_data - -/* - Uncomment the line below to remove records with null `id` values -*/ - --- where id is not null diff --git a/marketing_insights/models/example/my_second_dbt_model.sql b/marketing_insights/models/example/my_second_dbt_model.sql deleted file mode 100644 index c91f879..0000000 --- a/marketing_insights/models/example/my_second_dbt_model.sql +++ /dev/null @@ -1,6 +0,0 @@ - --- Use the `ref` function to select from other models - -select * -from {{ ref('my_first_dbt_model') }} -where id = 1 diff --git a/marketing_insights/models/example/schema.yml b/marketing_insights/models/example/schema.yml deleted file mode 100644 index f6c8ac1..0000000 --- a/marketing_insights/models/example/schema.yml +++ /dev/null @@ -1,20 +0,0 @@ - -version: 2 - -models: - - name: my_first_dbt_model - description: "A starter dbt model" - columns: - - name: id - description: "The primary key for this table" - data_tests: - - unique - - - name: my_second_dbt_model - description: "A starter dbt model" - columns: - - name: id - description: "The primary key for this table" - data_tests: - - unique - - not_null diff --git a/marketing_insights/models/mart/rpt_order_insights.sql b/marketing_insights/models/reporting/rpt_order_insights.sql similarity index 100% rename from marketing_insights/models/mart/rpt_order_insights.sql rename to marketing_insights/models/reporting/rpt_order_insights.sql