Skip to content

Commit

Permalink
chore: run task format
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Feb 3, 2025
1 parent aaf87f1 commit 5f48d6c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/dbt_osmosis/core/osmosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
)
from dbt.mp_context import get_mp_context
from dbt.node_types import NodeType
from dbt.parser.models import ModelParser
from dbt.parser.manifest import ManifestLoader, process_node
from dbt.parser.models import ModelParser
from dbt.parser.sql import SqlBlockParser, SqlMacroParser
from dbt.task.docs.generate import Catalog
from dbt.task.sql import SqlCompileRunner
Expand Down Expand Up @@ -251,6 +251,7 @@ def manifest_mutex(self) -> threading.Lock:
"""Return the manifest mutex for thread safety."""
return self._manifest_mutex


def _add_cross_project_references(manifest, dbt_loom, project_name):
"""Add cross-project references to the dbt manifest from dbt-loom defined manifests."""
loomnodes = []
Expand All @@ -263,12 +264,14 @@ def _add_cross_project_references(manifest, dbt_loom, project_name):
for _, node in loom_manifest_nodes.items():
if node.get("access"):
node_access = node.get("access")
if node_access!="protected":
if node.get("resource_type")=="model":
if node_access != "protected":
if node.get("resource_type") == "model":
loomnodes.append(ModelParser.parse_from_dict(None, node))
for node in loomnodes:
manifest.nodes[node.unique_id] = node
logger.info(f":arrows_counterclockwise: added {len(loomnodes)} exposed nodes from {name} to the dbt manifest!")
logger.info(
f":arrows_counterclockwise: added {len(loomnodes)} exposed nodes from {name} to the dbt manifest!"
)
return manifest


Expand Down Expand Up @@ -317,7 +320,6 @@ def create_dbt_project_context(config: DbtConfiguration) -> DbtProjectContext:
setattr(runtime_cfg, "adapter", adapter)
adapter.set_macro_resolver(manifest)


sql_parser = SqlBlockParser(runtime_cfg, manifest, runtime_cfg)
macro_parser = SqlMacroParser(runtime_cfg, manifest)

Expand Down Expand Up @@ -790,9 +792,12 @@ def f(node: ResultNode, include_external: bool = False) -> bool:
if node.resource_type == NodeType.Model and node.config.materialized == "ephemeral":
return False
if context.settings.models:
if not _is_file_match(
node, context.settings.models, context.project.runtime_cfg.project_root
) and not include_external:
if (
not _is_file_match(
node, context.settings.models, context.project.runtime_cfg.project_root
)
and not include_external
):
return False
if context.settings.fqn:
if not _is_fqn_match(node, context.settings.fqn):
Expand Down

0 comments on commit 5f48d6c

Please sign in to comment.