add claude skills
This commit is contained in:
44
skills/dbt-create-transform/trf_template.sql
Normal file
44
skills/dbt-create-transform/trf_template.sql
Normal file
@@ -0,0 +1,44 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ['KEY_COL_1', 'KEY_COL_2'],
|
||||
on_schema_change = 'sync_all_columns',
|
||||
incremental_strategy = 'delete+insert'
|
||||
) }}
|
||||
|
||||
{{- sie_dbt_utils.full_refresh_protection() -}}
|
||||
-- remove the line above if sie_dbt_utils is not available
|
||||
|
||||
with
|
||||
base_table as (
|
||||
select *
|
||||
from {{ ref('stg_<system>_<table>') }}
|
||||
where mandt in ('022', '100') -- replace with your tenant/client filter
|
||||
),
|
||||
|
||||
related_table as (
|
||||
select *
|
||||
from {{ ref('stg_<system>_<other_table>') }}
|
||||
),
|
||||
|
||||
final as (
|
||||
select
|
||||
base_table.COLUMN_1 as READABLE_COLUMN_1,
|
||||
base_table.COLUMN_2 as READABLE_COLUMN_2,
|
||||
related_table.COLUMN_A as READABLE_COLUMN_A
|
||||
|
||||
from base_table
|
||||
left join related_table
|
||||
on base_table.join_key = related_table.join_key
|
||||
|
||||
where year(dateadd(month, 3, to_date(base_table.date_col, 'yyyymmdd')))
|
||||
>= year(dateadd(year, -2, dateadd(month, 3, getdate())))
|
||||
-- ^ Siemens fiscal year filter (FY = calendar year + 3 months)
|
||||
-- Replace with your project's date filter logic
|
||||
|
||||
{% if is_incremental() %}
|
||||
and year(dateadd(month, 3, to_date(base_table.date_col, 'yyyymmdd')))
|
||||
<= year(add_months(current_date(), 3))
|
||||
{% endif %}
|
||||
)
|
||||
|
||||
select * from final
|
||||
Reference in New Issue
Block a user