2024-07-05 17:54:16 +08:00
|
|
|
{{
|
|
|
|
config(
|
|
|
|
materialized='incremental',
|
2024-07-23 10:33:41 +08:00
|
|
|
engine="MergeTree",
|
2024-07-10 16:14:09 +08:00
|
|
|
order_by="(date_id, ts_code)",
|
|
|
|
unique_key=['date_id', 'ts_code'],
|
2024-07-23 10:33:41 +08:00
|
|
|
incremental_strategy='delete+insert',
|
2024-07-05 17:54:16 +08:00
|
|
|
)
|
|
|
|
}}
|
|
|
|
|
|
|
|
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 %}
|