mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 13:41:54 +00:00
parent
f41a42a06b
commit
2bd688d673
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,10 +1,7 @@
|
||||
target/*
|
||||
dbt_modules/
|
||||
dbt_packages/
|
||||
logs/
|
||||
.env
|
||||
.venv/
|
||||
.python-version
|
||||
.notes
|
||||
dbt_docs.sh
|
||||
*.DS_Store
|
||||
@ -12,10 +9,3 @@ dbt_docs.sh
|
||||
!target/index.html
|
||||
!target/catalog.json
|
||||
!target/manifest.json
|
||||
|
||||
# Visual Studio Code files
|
||||
*/.vscode
|
||||
*.code-workspace
|
||||
.history/
|
||||
**/.DS_Store
|
||||
.vscode/
|
||||
@ -1,4 +1,4 @@
|
||||
FROM dbt-labs/dbt:1.0.0
|
||||
FROM fishtownanalytics/dbt:0.21.1
|
||||
WORKDIR /support
|
||||
RUN mkdir /root/.dbt
|
||||
COPY profiles.yml /root/.dbt
|
||||
|
||||
@ -6,15 +6,15 @@ version: "1.0.0"
|
||||
config-version: 2
|
||||
|
||||
# This setting configures which "profile" dbt uses for this project.
|
||||
profile: "near"
|
||||
profile: "default"
|
||||
|
||||
# These configurations specify where dbt should look for different types of files.
|
||||
# The `source-paths` config, for example, states that models in this project can be
|
||||
# found in the "models/" directory. You probably won't need to change these!
|
||||
model-paths: ["models"]
|
||||
source-paths: ["models"]
|
||||
analysis-paths: ["analysis"]
|
||||
test-paths: ["tests"]
|
||||
seed-paths: ["data"]
|
||||
data-paths: ["data"]
|
||||
macro-paths: ["macros"]
|
||||
snapshot-paths: ["snapshots"]
|
||||
|
||||
@ -22,7 +22,6 @@ target-path: "target" # directory which will store compiled SQL files
|
||||
clean-targets: # directories to be removed by `dbt clean`
|
||||
- "target"
|
||||
- "dbt_modules"
|
||||
- "dbt_packages"
|
||||
|
||||
# Configuring models
|
||||
# Full documentation: https://docs.getdbt.com/docs/configuring-models
|
||||
@ -31,10 +30,10 @@ clean-targets: # directories to be removed by `dbt clean`
|
||||
# as tables. These settings can be overridden in the individual model files
|
||||
# using the `{{ config(...) }}` macro.
|
||||
models:
|
||||
+post-hook: "{{ grant_data_share() }}"
|
||||
near:
|
||||
# # Config indicated by + and applies to all files under models/example/
|
||||
# example:
|
||||
# +materialized: view
|
||||
|
||||
tests:
|
||||
+severity: warn # all tests
|
||||
|
||||
vars:
|
||||
"dbt_date:time_zone": GMT
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
{% macro grant_data_share() %}
|
||||
{% if target.schema == 'PROD' %}
|
||||
GRANT
|
||||
SELECT
|
||||
ON ALL tables IN schema "NEAR"."PROD" TO SHARE "NEAR_MDAO";
|
||||
{% else %}
|
||||
SELECT
|
||||
1;
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
@ -1,34 +0,0 @@
|
||||
{% test sequence_gaps(
|
||||
model,
|
||||
partition_by,
|
||||
column_name
|
||||
) %}
|
||||
{%- set partition_sql = partition_by | join(", ") -%}
|
||||
{%- set previous_column = "prev_" ~ column_name -%}
|
||||
WITH source AS (
|
||||
SELECT
|
||||
{{ partition_sql + "," if partition_sql }}
|
||||
{{ column_name }},
|
||||
LAG(
|
||||
{{ column_name }},
|
||||
1
|
||||
) over (
|
||||
{{ "PARTITION BY " ~ partition_sql if partition_sql }}
|
||||
ORDER BY
|
||||
{{ column_name }} ASC
|
||||
) AS {{ previous_column }}
|
||||
FROM
|
||||
{{ model }}
|
||||
)
|
||||
SELECT
|
||||
{{ partition_sql + "," if partition_sql }}
|
||||
{{ previous_column }},
|
||||
{{ column_name }},
|
||||
{{ column_name }} - {{ previous_column }}
|
||||
- 1 AS gap
|
||||
FROM
|
||||
source
|
||||
WHERE
|
||||
{{ column_name }} - {{ previous_column }} <> 1
|
||||
ORDER BY
|
||||
gap DESC {% endtest %}
|
||||
@ -1,4 +1,4 @@
|
||||
near:
|
||||
default:
|
||||
target: dev
|
||||
outputs:
|
||||
dev:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user