-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decouple macro generator from adapters (#9149)
- Loading branch information
1 parent
1bca662
commit 00f4920
Showing
22 changed files
with
1,062 additions
and
1,006 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Remove usages of dbt.clients.jinja in dbt/adapters | ||
time: 2023-12-05T09:35:44.845352+09:00 | ||
custom: | ||
Author: michelleark | ||
Issue: "9205" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing import Dict, Any | ||
from dbt.common.clients.jinja import BaseMacroGenerator, get_environment | ||
|
||
|
||
class QueryStringGenerator(BaseMacroGenerator): | ||
def __init__(self, template_str: str, context: Dict[str, Any]) -> None: | ||
super().__init__(context) | ||
self.template_str: str = template_str | ||
env = get_environment() | ||
self.template = env.from_string( | ||
self.template_str, | ||
globals=self.context, | ||
) | ||
|
||
def get_name(self) -> str: | ||
return "query_comment_macro" | ||
|
||
def get_template(self): | ||
"""Don't use the template cache, we don't have a node""" | ||
return self.template | ||
|
||
def __call__(self, connection_name: str, node) -> str: | ||
return str(self.call_macro(connection_name, node)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.