Skip to content

Commit

Permalink
Hack to move inline node from disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank committed Jun 5, 2024
1 parent b91f848 commit 35036e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions core/dbt/task/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/graph_selection/test_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 35036e5

Please sign in to comment.