-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RelationConfig Protocol for use in Relation.create_from #9210
Changes from all commits
7f777f8
2cee865
160d0db
d7d5e23
b8de881
ba53f05
6796edd
7ad6aa1
7ad1acc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Introduce RelationConfig Protocol, consolidate Relation.create_from | ||
time: 2023-12-05T17:07:25.33861+09:00 | ||
custom: | ||
Author: michelleark | ||
Issue: "9215" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -423,7 +423,7 @@ def _get_cache_schemas(self, manifest: Manifest) -> Set[BaseRelation]: | |
""" | ||
# the cache only cares about executable nodes | ||
return { | ||
self.Relation.create_from(self.config, node).without_identifier() | ||
self.Relation.create_from(self.config, node).without_identifier() # type: ignore[arg-type] | ||
for node in manifest.nodes.values() | ||
if (node.is_relational and not node.is_ephemeral_model and not node.is_external_node) | ||
} | ||
|
@@ -470,7 +470,7 @@ def _get_catalog_relations(self, manifest: Manifest) -> List[BaseRelation]: | |
manifest.sources.values(), | ||
) | ||
|
||
relations = [self.Relation.create_from(self.config, n) for n in nodes] | ||
relations = [self.Relation.create_from(self.config, n) for n in nodes] # type: ignore[arg-type] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this gets cleaned up in: #9212 |
||
return relations | ||
|
||
def _relations_cache_for_schemas( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,14 @@ class RelationType(StrEnum): | |
Ephemeral = "ephemeral" | ||
|
||
|
||
class RelationConfig(Protocol): | ||
name: str | ||
database: str | ||
schema: str | ||
identifier: str | ||
quoting_dict: Dict[str, bool] | ||
Comment on lines
+25
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we may want to include meta or tags to accommodate adapter-specific implementations, for example in dbt-duckdb: https://github.com/duckdb/dbt-duckdb/blob/master/dbt/adapters/duckdb/relation.py#L11 But these are the attributes necessary for core <> adapters + postgres. Have carved out an issue to add additional fields later on: https://github.com/dbt-labs/dbt-core/issues/9216 |
||
|
||
|
||
class ComponentName(StrEnum): | ||
Database = "database" | ||
Schema = "schema" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this gets cleaned up in: #9213