adding gha and pks

This commit is contained in:
WHYTEWYLL 2023-11-09 15:39:18 -03:00
parent 40823efeb8
commit 4368aaf800
4 changed files with 46 additions and 2 deletions

34
.github/workflows/dbt_run_atlas.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: dbt_run_atlas
run-name: dbt_run_atlas
on:
workflow_dispatch:
schedule:
# Runs weekly at 0 UTC on Mondays (see https://crontab.guru)
- cron: "0 0 * * 1"
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_template.yml@main
with:
dbt_command: >
dbt run -s tag:atlas
environment: workflow_prod
warehouse: ${{ vars.WAREHOUSE }}
secrets: inherit

View File

@ -7,6 +7,7 @@
WITH nft_data AS (
SELECT
atlas_account_created_id,
day,
wallets_created,
total_wallets,

View File

@ -1,7 +1,7 @@
{{ config(
materialized = 'incremental',
unique_key = 'day',
unique_key = 'atlas_account_created_id',
incremental_strategy = 'merge',
merge_exclude_columns = ["inserted_timestamp"],
tags = ['atlas']
@ -30,6 +30,9 @@ DAILY_TOTALS AS (
)
FINAL AS (
SELECT
{{ dbt_utils.generate_surrogate_key(
['receiver_id']
) }} AS atlas_account_created_id,
block_timestamp::date AS day,
COUNT(*) AS wallets_created,
SUM(count(*)) OVER (ORDER BY day) total_wallets,

View File

@ -5,11 +5,17 @@ models:
description: |-
Wallet creation on NEAR
columns:
- name: atlas_account_created_id
description: "{{ doc('id')}}"
tests:
- not_null
- unique
- name: day
description: "{{ doc('date')}}"
tests:
- not_null
- unique
- name: wallets_created
description: "The number of wallets created on NEAR on the given day."
tests: