22 lines
921 B
SQL
22 lines
921 B
SQL
{% 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 %}
|