沈楠
9d9c343b71
Some checks failed
MJN/finance-dbt/pipeline/head There was a failure building this commit
19 lines
565 B
SQL
19 lines
565 B
SQL
{{
|
|
config(
|
|
materialized='incremental',
|
|
engine="MergeTree",
|
|
order_by="ts_code, date_id",
|
|
unique_key=['ts_code', 'date_id'],
|
|
incremental_strategy='delete+insert',
|
|
)
|
|
}}
|
|
|
|
Select
|
|
ts_code As ts_code,
|
|
toYYYYMMDD(toDate(trade_date)) As date_id,
|
|
adj_factor As adj_factor,
|
|
dt As dt
|
|
From {{ source('finance', 'stg.tushare_adj_factor') }} As StgAdjFactor
|
|
{% if is_incremental() %}
|
|
Where `trade_date` >= (Select formatDateTimeInJodaSyntax(YYYYMMDDToDate(max(`date_id`)), 'yyyy-MM-dd') From {{ this }})
|
|
{% endif %} |