diff --git a/core/dbt/task/compile.py b/core/dbt/task/compile.py index 5470c67c68d..d2460852fc5 100644 --- a/core/dbt/task/compile.py +++ b/core/dbt/task/compile.py @@ -104,6 +104,12 @@ def _runtime_initialize(self): ) sql_node = block_parser.parse_remote(self.args.inline, "inline_query") process_node(self.config, self.manifest, sql_node) + # Special hack to remove disabled, if it's there. This would only happen + # if all models are disabled in dbt_project + if sql_node.config.enabled is False: + sql_node.config.enabled = True + self.manifest.disabled.pop(sql_node.unique_id) + self.manifest.nodes[sql_node.unique_id] = sql_node # keep track of the node added to the manifest self._inline_node_id = sql_node.unique_id except CompilationError as exc: diff --git a/tests/functional/graph_selection/test_inline.py b/tests/functional/graph_selection/test_inline.py index 7ba4791cc65..bf01ec8ae6a 100644 --- a/tests/functional/graph_selection/test_inline.py +++ b/tests/functional/graph_selection/test_inline.py @@ -48,10 +48,10 @@ def test_inline_selectors(self, project): assert len(results) == 1 assert "Compiled inline node is:" in log_output - # Set all models to disabled, even inline model doesn't run + # Set all models to disabled, check that we still get inline result write_file(dbt_project_yml_disabled_models, project.project_root, "dbt_project.yml") (results, log_output) = run_dbt_and_capture(["compile", "--inline", "select 1 as id"]) - assert len(results) == 0 + assert len(results) == 1 # put back non-disabled dbt_project and check for mutually exclusive error message # for --select and --inline