diff --git a/.gitignore b/.gitignore index e3b3b2d..ea7cc36 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c5ee0e8..7eac971 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/dbt_project.yml b/dbt_project.yml index 0b825e8..a56bd35 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -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 diff --git a/macros/data_share.sql b/macros/data_share.sql deleted file mode 100644 index 1b0138f..0000000 --- a/macros/data_share.sql +++ /dev/null @@ -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 %} diff --git a/macros/sequence_gaps.sql b/macros/sequence_gaps.sql deleted file mode 100644 index 9425003..0000000 --- a/macros/sequence_gaps.sql +++ /dev/null @@ -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 %} diff --git a/profiles.yml b/profiles.yml index 011c040..250ef84 100644 --- a/profiles.yml +++ b/profiles.yml @@ -1,4 +1,4 @@ -near: +default: target: dev outputs: dev: