-
Notifications
You must be signed in to change notification settings - Fork 181
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
added macro for wh selection #503
Changes from 8 commits
82c640d
40c5948
aa20ddc
9c665d8
7d67aa1
10b63ca
f3e68d8
db1f7cb
ed0c3a0
f6ca3bf
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,3 @@ | ||
kind: Added | ||
body: Macro for custom warehouse selection | ||
time: 2022-03-21T16:28:32.82239+01:00 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: take over pr:103 to allow Macro for custom warehouse selection | ||
time: 2023-03-07T14:09:33.713772-06:00 | ||
custom: | ||
Author: javiCalvo | ||
Issue: "438" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,9 @@ | |
from dbt.utils import filter_null_values | ||
|
||
|
||
SNOWFLAKE_WAREHOUSE_MACRO_NAME = "snowflake_warehouse" | ||
|
||
|
||
@dataclass | ||
class SnowflakeConfig(AdapterConfig): | ||
transient: Optional[bool] = None | ||
|
@@ -73,6 +76,8 @@ def _get_warehouse(self) -> str: | |
|
||
def _use_warehouse(self, warehouse: str): | ||
"""Use the given warehouse. Quotes are never applied.""" | ||
kwargs = {"warehouse": warehouse} | ||
warehouse = self.execute_macro(SNOWFLAKE_WAREHOUSE_MACRO_NAME, kwargs=kwargs) # type: ignore | ||
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. curious if anyone has an idea as to why this causes a 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. It's silly, but you can remove the type annotation from 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. oh that's interesting iI didn't think the type value for the "warehouse" input would bother the previously defined one for |
||
self.execute("use warehouse {}".format(warehouse)) | ||
|
||
def pre_model_hook(self, config: Mapping[str, Any]) -> Optional[str]: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% macro snowflake_warehouse(warehouse) -%} | ||
{{ return(warehouse) }} | ||
{%- endmacro %} |
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.
Is this a supported format? I feel like our process to roll up change logs might not like this. Based on the timestamp, it might be an older format.
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 part might be from before some more recent changes to our changie logic so yeah can remove