-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into expandIntegTesting
- Loading branch information
Showing
19 changed files
with
300 additions
and
28 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: Features | ||
body: Support refresh_mode and initialize parameters for dynamic tables | ||
time: 2024-01-31T12:53:18.111616Z | ||
custom: | ||
Author: HenkvanDyk,mikealfare | ||
Issue: "1076" |
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: Fixes | ||
body: 'Rename targets for tables and views use fully qualified names' | ||
time: 2024-05-22T16:05:38.602074-04:00 | ||
custom: | ||
Author: mikealfare | ||
Issue: "1031" |
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 |
---|---|---|
@@ -1,43 +1,41 @@ | ||
# **what?** | ||
# Open an issue in docs.getdbt.com when a PR is labeled `user docs` | ||
# Open an issue in docs.getdbt.com when an issue is labeled `user docs` and closed as completed | ||
|
||
# **why?** | ||
# To reduce barriers for keeping docs up to date | ||
|
||
# **when?** | ||
# When a PR is labeled `user docs` and is merged. Runs on pull_request_target to run off the workflow already merged, | ||
# not the workflow that existed on the PR branch. This allows old PRs to get comments. | ||
# When an issue is labeled `user docs` and is closed as completed. Can be labeled before or after the issue is closed. | ||
|
||
|
||
name: Open issues in docs.getdbt.com repo when a PR is labeled | ||
run-name: "Open an issue in docs.getdbt.com for PR #${{ github.event.pull_request.number }}" | ||
name: Open issues in docs.getdbt.com repo when an issue is labeled | ||
run-name: "Open an issue in docs.getdbt.com for issue #${{ github.event.issue.number }}" | ||
|
||
on: | ||
pull_request_target: | ||
issues: | ||
types: [labeled, closed] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: | ||
issues: write # opens new issues | ||
pull-requests: write # comments on PRs | ||
|
||
issues: write # comments on issues | ||
|
||
jobs: | ||
open_issues: | ||
# we only want to run this when the PR has been merged or the label in the labeled event is `user docs`. Otherwise it runs the | ||
# we only want to run this when the issue is closed as completed and the label `user docs` has been assigned. | ||
# If this logic does not exist in this workflow, it runs the | ||
# risk of duplicaton of issues being created due to merge and label both triggering this workflow to run and neither having | ||
# generating the comment before the other runs. This lives here instead of the shared workflow because this is where we | ||
# decide if it should run or not. | ||
if: | | ||
(github.event.pull_request.merged == true) && | ||
((github.event.action == 'closed' && contains( github.event.pull_request.labels.*.name, 'user docs')) || | ||
(github.event.issue.state == 'closed' && github.event.issue.state_reason == 'completed') && ( | ||
(github.event.action == 'closed' && contains(github.event.issue.labels.*.name, 'user docs')) || | ||
(github.event.action == 'labeled' && github.event.label.name == 'user docs')) | ||
uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main | ||
with: | ||
issue_repository: "dbt-labs/docs.getdbt.com" | ||
issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} PR #${{ github.event.pull_request.number }}" | ||
issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} Issue #${{ github.event.issue.number }}" | ||
issue_body: "At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated." | ||
secrets: inherit |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{%- macro snowflake__get_create_backup_sql(relation) -%} | ||
|
||
-- get the standard backup name | ||
{% set backup_relation = make_backup_relation(relation, relation.type) %} | ||
|
||
-- drop any pre-existing backup | ||
{{ get_drop_sql(backup_relation) }}; | ||
|
||
-- use `render` to ensure that the fully qualified name is used | ||
{{ get_rename_sql(relation, backup_relation.render()) }} | ||
|
||
{%- endmacro -%} |
12 changes: 10 additions & 2 deletions
12
dbt/include/snowflake/macros/relations/dynamic_table/create.sql
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
18 changes: 12 additions & 6 deletions
18
dbt/include/snowflake/macros/relations/dynamic_table/replace.sql
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 |
---|---|---|
@@ -1,12 +1,18 @@ | ||
{% macro snowflake__get_replace_dynamic_table_sql(relation, sql) %} | ||
{% macro snowflake__get_replace_dynamic_table_sql(relation, sql) -%} | ||
|
||
{%- set dynamic_table = relation.from_config(config.model) -%} | ||
|
||
create or replace dynamic table {{ relation }} | ||
target_lag = '{{ config.get("target_lag") }}' | ||
warehouse = {{ config.get("snowflake_warehouse") }} | ||
target_lag = '{{ dynamic_table.target_lag }}' | ||
warehouse = {{ dynamic_table.snowflake_warehouse }} | ||
{% if dynamic_table.refresh_mode %} | ||
refresh_mode = {{ dynamic_table.refresh_mode }} | ||
{% endif %} | ||
{% if dynamic_table.initialize %} | ||
initialize = {{ dynamic_table.initialize }} | ||
{% endif %} | ||
as ( | ||
{{ sql }} | ||
) | ||
; | ||
{{ snowflake__refresh_dynamic_table(relation) }} | ||
|
||
{% endmacro %} | ||
{%- endmacro %} |
9 changes: 9 additions & 0 deletions
9
dbt/include/snowflake/macros/relations/rename_intermediate.sql
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,9 @@ | ||
{%- macro snowflake__get_rename_intermediate_sql(relation) -%} | ||
|
||
-- get the standard intermediate name | ||
{% set intermediate_relation = make_intermediate_relation(relation) %} | ||
|
||
-- use `render` to ensure that the fully qualified name is used | ||
{{ get_rename_sql(intermediate_relation, relation.render()) }} | ||
|
||
{%- endmacro -%} |
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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
{%- macro snowflake__get_rename_table_sql(relation, new_name) -%} | ||
/* | ||
Rename or move a table to the new name. | ||
Args: | ||
relation: SnowflakeRelation - relation to be renamed | ||
new_name: Union[str, SnowflakeRelation] - new name for `relation` | ||
if providing a string, the default database/schema will be used if that string is just an identifier | ||
if providing a SnowflakeRelation, `render` will be used to produce a fully qualified name | ||
Returns: templated string | ||
*/ | ||
alter table {{ relation }} rename to {{ new_name }} | ||
{%- endmacro -%} |
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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
{%- macro snowflake__get_rename_view_sql(relation, new_name) -%} | ||
/* | ||
Rename or move a view to the new name. | ||
Args: | ||
relation: SnowflakeRelation - relation to be renamed | ||
new_name: Union[str, SnowflakeRelation] - new name for `relation` | ||
if providing a string, the default database/schema will be used if that string is just an identifier | ||
if providing a SnowflakeRelation, `render` will be used to produce a fully qualified name | ||
Returns: templated string | ||
*/ | ||
alter view {{ relation }} rename to {{ new_name }} | ||
{%- endmacro -%} |
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.