From 15824ff6ea336faa746b01cd22dbb08035d49096 Mon Sep 17 00:00:00 2001 From: Eric Laurello Date: Mon, 5 Jun 2023 17:17:55 -0400 Subject: [PATCH] datashares --- .github/workflows/dbt_docs_update.yml | 48 ++----------------- .github/workflows/dbt_run_deployment.yml | 48 +++++++++++++++++++ .../_datashare/_datashare___create_gold.sql | 20 -------- packages.yml | 4 +- 4 files changed, 54 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/dbt_run_deployment.yml delete mode 100644 models/_datashare/_datashare___create_gold.sql diff --git a/.github/workflows/dbt_docs_update.yml b/.github/workflows/dbt_docs_update.yml index ffeb9ee..addc968 100644 --- a/.github/workflows/dbt_docs_update.yml +++ b/.github/workflows/dbt_docs_update.yml @@ -22,48 +22,6 @@ concurrency: group: ${{ github.workflow }} jobs: - scheduled_run: - name: docs_update - runs-on: ubuntu-latest - environment: - name: workflow_prod - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v1 - with: - python-version: "3.7.x" - - - name: install dependencies - run: | - pip install dbt-snowflake==${{ vars.DBT_VERSION }} - dbt deps - - name: checkout docs branch - run: | - git checkout -b docs origin/main - - - name: generate dbt docs - run: dbt docs generate -t prod - - - name: move files to docs directory - run: | - mkdir -p ./docs - cp target/{catalog.json,manifest.json,index.html} docs/ - - name: clean up target directory - run: dbt clean - - - name: check for changes - run: git status - - - name: stage changed files - run: git add . - - - name: commit changed files - run: | - git config user.email "abc@xyz" - git config user.name "github-actions" - git commit -am "Auto-update docs" - - name: push changes to docs - run: | - git push -f --set-upstream origin docs \ No newline at end of file + called_workflow_template: + uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_docs_updates.yml@main + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_deployment.yml b/.github/workflows/dbt_run_deployment.yml new file mode 100644 index 0000000..19073eb --- /dev/null +++ b/.github/workflows/dbt_run_deployment.yml @@ -0,0 +1,48 @@ +name: dbt_run_deployment +run-name: dbt_run_deployment + +on: + workflow_dispatch: + branches: + - "main" + inputs: + warehouse: + type: choice + description: Snowflake warehouse + required: true + options: + - DBT + - DBT_CLOUD + - DBT_EMERGENCY + default: DBT + dbt_command: + type: string + description: 'DBT Run Command' + required: true + +env: + USE_VARS: "${{ vars.USE_VARS }}" + DBT_PROFILES_DIR: "${{ vars.DBT_PROFILES_DIR }}" + DBT_VERSION: "${{ vars.DBT_VERSION }}" + ACCOUNT: "${{ vars.ACCOUNT }}" + ROLE: "${{ vars.ROLE }}" + USER: "${{ vars.USER }}" + PASSWORD: "${{ secrets.PASSWORD }}" + REGION: "${{ vars.REGION }}" + DATABASE: "${{ vars.DATABASE }}" + WAREHOUSE: "${{ vars.WAREHOUSE }}" + SCHEMA: "${{ vars.SCHEMA }}" + + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_run_deployment_template.yml@main + with: + dbt_command: | + ${{ inputs.dbt_command }} + environment: workflow_prod + warehouse: ${{ vars.WAREHOUSE }} + secrets: inherit \ No newline at end of file diff --git a/models/_datashare/_datashare___create_gold.sql b/models/_datashare/_datashare___create_gold.sql deleted file mode 100644 index 36d9199..0000000 --- a/models/_datashare/_datashare___create_gold.sql +++ /dev/null @@ -1,20 +0,0 @@ -{{ - config( - materialized = 'incremental', - incremental_strategy = 'merge', - unique_key = 'ddl_hash', - merge_update_columns = [], - ) -}} -{% if execute %} -SELECT -$${{- generate_datashare_ddl() -}}$$ AS ddl, -md5(ddl) AS ddl_hash, -sysdate() as ddl_created_at -{% else %} -SELECT -null as ddl, -null as ddl_hash, -null as ddl_created_at -from dual limit 0 -{% endif %} \ No newline at end of file diff --git a/packages.yml b/packages.yml index e799c13..d87683a 100644 --- a/packages.yml +++ b/packages.yml @@ -4,4 +4,6 @@ packages: - package: dbt-labs/dbt_external_tables version: [">=0.8.0", "<0.9.0"] - package: dbt-labs/dbt_utils - version: [">=1.0.0", "<1.1.0"] \ No newline at end of file + version: [">=1.0.0", "<1.1.0"] + - git: https://github.com/FlipsideCrypto/fsc-utils.git + revision: "v1.3.0" \ No newline at end of file