Skip to content

Commit

Permalink
Merge pull request #371 from dbt-labs/fix-exclusion
Browse files Browse the repository at this point in the history
add excluded package
  • Loading branch information
graciegoheen authored Aug 17, 2023
2 parents 88e916f + b3b3a04 commit 9d7676d
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ seeds:

vars:
# ensure integration tests run successfully when there are 0 of a given model type (extra)
exclude_packages: []
exclude_packages: ['exclude_package']
exclude_paths_from_project: ["/to_exclude/","source_3.table_6"]
model_types: ['staging', 'intermediate', 'marts', 'other', 'extra', 'new_model_type']
# dummy variable used for testing fct_hard_coded_references
Expand Down
30 changes: 30 additions & 0 deletions integration_tests/exclude_package/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'exclude_package'
version: '1.0.0'
config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: 'integration_tests'

# 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"]
analysis-paths: ["analysis"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

target-path: "target" # directory which will store compiled SQL files
clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_packages"

models:
exclude_package:
# materialize as ephemeral to prevent the fake models from executing, but keep them enabled
+materialized: view
9 changes: 9 additions & 0 deletions integration_tests/exclude_package/models/_models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
models:
- name: excluded_model
access: public
config:
contract:
enforced: true
columns:
- name: id
data_type: integer
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select 1 as id
3 changes: 2 additions & 1 deletion integration_tests/packages.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
packages:
- local: ../
- local: ../
- local: exclude_package/
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ direct_exposure_relationships as (
parent_resource_type = 'model'
and parent_is_public
)
and not parent_is_excluded
),

final as (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ with

all_resources as (
select * from {{ ref('int_all_graph_resources') }}
where not is_excluded
),

final as (
Expand Down
1 change: 1 addition & 0 deletions models/marts/governance/fct_undocumented_public_models.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ with

all_resources as (
select * from {{ ref('int_all_graph_resources') }}
where not is_excluded
),

final as (
Expand Down
1 change: 1 addition & 0 deletions models/marts/structure/fct_model_directories.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

with all_graph_resources as (
select * from {{ ref('int_all_graph_resources') }}
where not is_excluded
),

folders as (
Expand Down

0 comments on commit 9d7676d

Please sign in to comment.