-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADAP-542: Add configuration options for dynamic tables (#636)
* add new config enums * added refresh strategy query and relation method to determine differences * added dynamic table ddl * tests mostly pass, fail due to dynamic table being unavailable * updated with materialized views pushed to main, added retry to get_row_count for dynamic table initialization
- Loading branch information
1 parent
02c947f
commit 9111c25
Showing
9 changed files
with
254 additions
and
64 deletions.
There are no files selected for viewing
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,26 @@ | ||
from dataclasses import dataclass | ||
|
||
from dbt.adapters.relation_configs import RelationConfigBase | ||
|
||
from dbt.adapters.snowflake.relation_configs.lag import SnowflakeDynamicTableLagConfig | ||
|
||
|
||
@dataclass(frozen=True, eq=True, unsafe_hash=True) | ||
class SnowflakeDynamicTableConfig(RelationConfigBase): | ||
""" | ||
This config follow the specs found here: | ||
https://docs.snowflake.com/en/LIMITEDACCESS/create-dynamic-table | ||
The following parameters are configurable by dbt: | ||
- name: name of the dynamic table | ||
- query: the query behind the table | ||
- lag: the maximum amount of time that the dynamic table’s content should lag behind updates to the base tables | ||
- warehouse: the name of the warehouse that provides the compute resources for refreshing the dynamic table | ||
There are currently no non-configurable parameters. | ||
""" | ||
|
||
name: str | ||
query: str | ||
lag: SnowflakeDynamicTableLagConfig | ||
warehouse: str |
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,28 @@ | ||
from dataclasses import dataclass | ||
|
||
from dbt.adapters.relation_configs import RelationConfigBase | ||
from dbt.dataclass_schema import StrEnum | ||
|
||
|
||
class SnowflakeDynamicTableLagPeriod(StrEnum): | ||
seconds = "seconds" | ||
minutes = "minutes" | ||
hours = "hours" | ||
days = "days" | ||
|
||
|
||
@dataclass(frozen=True, eq=True, unsafe_hash=True) | ||
class SnowflakeDynamicTableLagConfig(RelationConfigBase): | ||
""" | ||
This config follow the specs found here: | ||
https://docs.snowflake.com/en/LIMITEDACCESS/create-dynamic-table | ||
The following parameters are configurable by dbt: | ||
- duration: the numeric part of the lag | ||
- period: the scale part of the lag | ||
There are currently no non-configurable parameters. | ||
""" | ||
|
||
duration: int | ||
period: SnowflakeDynamicTableLagPeriod |
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
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
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.