diff --git a/dbt/compilation.py b/dbt/compilation.py index 569149c125e..7feb0e4edd7 100644 --- a/dbt/compilation.py +++ b/dbt/compilation.py @@ -224,8 +224,8 @@ def do_ref(*args): target_model_id = target_model.get('unique_id') - if target_model.get('config', {}) \ - .get('enabled') is False: + if target_model.get('config', {}).get('enabled') is False and \ + model.get('config', {}).get('enabled') is True: compiler_error( model, "Model '{}' depends on model '{}' which is disabled in " diff --git a/test/integration/006_simple_dependency_test/models/disabled_one.sql b/test/integration/006_simple_dependency_test/models/disabled_one.sql new file mode 100644 index 00000000000..6f373105aac --- /dev/null +++ b/test/integration/006_simple_dependency_test/models/disabled_one.sql @@ -0,0 +1,3 @@ +{{config(enabled=False)}} + +select 1 diff --git a/test/integration/006_simple_dependency_test/models/disabled_two.sql b/test/integration/006_simple_dependency_test/models/disabled_two.sql new file mode 100644 index 00000000000..b20d379edea --- /dev/null +++ b/test/integration/006_simple_dependency_test/models/disabled_two.sql @@ -0,0 +1,3 @@ +{{config(enabled=False)}} + +select * from {{ref('disabled_one')}}