Skip to content

Commit

Permalink
generalize Relation creation for external nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Jun 20, 2023
1 parent 0edf25c commit fdd874b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/dbt/adapters/base/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def create_from_node(
**kwargs: Any,
) -> Self:
if quote_policy is None:
quote_policy = {}
quote_policy = node.config.quoting if hasattr(node.config, "quoting") else {}

quote_policy = dbt.utils.merge(config.quoting, quote_policy)

Expand Down
6 changes: 1 addition & 5 deletions core/dbt/context/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,7 @@ def resolve(
return self.create_relation(target_model)

def create_relation(self, target_model: ManifestNode) -> RelationProxy:
if target_model.is_external_node:
# Get quoting from publication artifact
pub_metadata = self.manifest.publications[target_model.package_name].metadata
return self.Relation.create_from_node(pub_metadata, target_model)
elif target_model.is_ephemeral_model:
if target_model.is_ephemeral_model:
self.model.set_cte(target_model.unique_id, None)
return self.Relation.create_ephemeral_from_node(self.config, target_model)
else:
Expand Down
2 changes: 2 additions & 0 deletions core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
ResultNode,
ModelNode,
NodeRelation,
NodeConfig,
)
from dbt.contracts.graph.unparsed import NodeVersion
from dbt.contracts.util import Writable
Expand Down Expand Up @@ -877,6 +878,7 @@ def load_new_public_nodes(self):
),
original_file_path="",
path="",
config=NodeConfig(publication.metadata.quoting),
)
)

Expand Down

0 comments on commit fdd874b

Please sign in to comment.