init
This commit is contained in:
21
dbt/macros/data_transform/create_table_from_source.sql
Normal file
21
dbt/macros/data_transform/create_table_from_source.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
{% macro create_table_from_source (schema, table, wf_name, task_name, except) %}
|
||||
{#
|
||||
Creates a table with a structure identical to the source table.
|
||||
The content of the created table are all rows from the source table that belong
|
||||
to the hightest WORKFLOW_HISTORY_KEY in the source table
|
||||
#}
|
||||
{% set a_workflow_history_key = get_workflow_history_key() %}
|
||||
--{{ check_null("a_workflow_history_key", a_workflow_history_key) }}
|
||||
{{ elog("a_workflow_history_key: " ~ a_workflow_history_key, "INFO", 2)}}
|
||||
{{ elog("Run macro insert_A_TASK_HISTORY for model " ~ model_name, "INFO", 1)}}
|
||||
{{ insert_A_TASK_HISTORY(a_workflow_history_key, model_name) }}
|
||||
|
||||
select
|
||||
{{ a_workflow_history_key }} AS A_WORKFLOW_HISTORY_KEY,
|
||||
source_table.*
|
||||
from {{ source(schema, table) }} source_table
|
||||
where source_table.A_WORKFLOW_HISTORY_KEY IN
|
||||
{{
|
||||
filter_workflow_history_key(wf_name, task_name)
|
||||
}}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user