-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Lasse Benninga <lassebenninga@gmail.com>
- Loading branch information
1 parent
ce3ee3e
commit 410b219
Showing
2 changed files
with
20 additions
and
5 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
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,27 @@ | ||
{% macro spark__recover_partitions(source_node) %} | ||
{# https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-alter-table.html #} | ||
|
||
{% set ddl %} | ||
{%- if source_node.external.partitions and source_node.external.using and source_node.external.using|lower != 'delta' -%} | ||
ALTER TABLE {{ source(source_node.source_name, source_node.name) }} RECOVER PARTITIONS | ||
{% set ddl %} | ||
ALTER TABLE {{ source(source_node.source_name, source_node.name) }} RECOVER PARTITIONS | ||
{% endset %} | ||
{%- else -%} | ||
{% set ddl = none %} | ||
{%- endif -%} | ||
{% endset %} | ||
|
||
{{return(ddl)}} | ||
|
||
{% endmacro %} | ||
|
||
{% macro recover_partitions(source_node) %} | ||
{{ return(adapter.dispatch('recover_partitions', 'dbt_external_tables')(source_node)) }} | ||
{% endmacro %} | ||
|
||
{% macro default__recover_partitions(source_node) %} | ||
/*{# | ||
We're dispatching this macro so that users can override it if required on other adapters | ||
but this will work for spark/databricks. | ||
#}*/ | ||
|
||
{{ exceptions.raise_not_implemented('recover_partitions macro not implemented for adapter ' + adapter.type()) }} | ||
{% endmacro %} |