datashares

This commit is contained in:
Eric Laurello 2023-06-05 17:17:55 -04:00
parent ed017e4f01
commit 15824ff6ea
4 changed files with 54 additions and 66 deletions

View File

@ -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
called_workflow_template:
uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_docs_updates.yml@main
secrets: inherit

View File

@ -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

View File

@ -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 %}

View File

@ -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"]
version: [">=1.0.0", "<1.1.0"]
- git: https://github.com/FlipsideCrypto/fsc-utils.git
revision: "v1.3.0"