Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sqlmesh/dbt/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def _macro_references(
return result

for macro_node_id in node.depends_on.macros:
if not macro_node_id:
if not macro_node_id or macro_node_id == "None":
continue

macro_node = manifest.macros[macro_node_id]
Expand Down
20 changes: 20 additions & 0 deletions tests/dbt/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,23 @@ def test_convert_jinja_test_to_macro():
{%- endmacro -%}"""

assert _convert_jinja_test_to_macro(macro_input) == macro_input


@pytest.mark.xdist_group("dbt_manifest")
def test_macro_depenency_none_str():
project_path = Path("tests/fixtures/dbt/sushi_test")
profile = Profile.load(DbtContext(project_path))
helper = ManifestHelper(
project_path,
project_path,
"sushi",
profile.target,
model_defaults=ModelDefaultsConfig(start="2020-01-01"),
)
node = helper._manifest.nodes["model.customers.customer_revenue_by_day"]
node.depends_on.macros.append("None")

from sqlmesh.dbt.manifest import _macro_references

# "None" macro shouldn't raise a KeyError
_macro_references(helper._manifest, node)