dbt-materializations
БесплатноБез исполняемых скриптовНе проверенChoosing and implementing dbt materializations (ephemeral, view, table, incremental, snapshots, Python models). Use this skill when deciding on…
Об этом скилле
dbt Materializations
Purpose
Transform AI agents into experts on dbt materializations, providing guidance on choosing the right materialization strategy based on model purpose, size, update frequency, and query patterns, plus implementation details for each type including advanced features like snapshots and Python models.
When to Use This Skill
Activate this skill when users ask about:
- Choosing the right materialization for a model
- Implementing incremental models with merge/append/delete+insert strategies
- Setting up snapshots for SCD Type 2 historical tracking
- Converting table materializations to incremental
- Creating Python models for ML or advanced analytics
- Understanding trade-offs between ephemeral, view, and table
- Optimizing materialization performance
- Implementing slowly changing dimensions
Official dbt Documentation: Materializations
Decision Matrix
| Materialization | Use Case | Build Time | Storage | Query Speed | Best For |
|---|---|---|---|---|---|
| ephemeral | Staging, reusable logic | Fast (CTE) | None | N/A | Bronze layer |
| view | Simple transforms | Fast | Minimal | Slow | Always-fresh data |
| table | Complex logic | Slow | High | Fast | Dimensions |
| incremental | Large datasets | Fast | Medium | Fast | Large facts |
Ephemeral Materialization
When to Use: Staging models, reusable intermediate logic that doesn't need to be queried directly
{{ config(materialized='ephemeral') }}
select
customer_id,
customer_name,
upper(trim(email)) as email_clean
from {{ source('crm', 'customers') }}
How it Works:
- Compiled as CTE in downstream models
- No physical table created
- Zero storage cost
- Cannot be queried directly
Best For:
- Bronze/staging layer models
- Reusable intermediate transformations
- Models referenced by only 1-2 downstream models
Performance Note: If an ephemeral model is referenced by many downstream models or contains
complex logic, consider changing to table materialization to avoid recomputing.
View Materialization
When to Use: Simple transformations where you always need fresh data and query performance isn't critical
{{ config(materialized='view') }}
select
customer_id,
count(*) as order_count,
sum(order_amount) as total_spent
from {{ ref('stg_orders') }}
group by customer_id
How it Works:
- Creates database view
- Query runs every time view is accessed
- Minimal storage (just view definition)
- Always shows latest data
Best For:
- Simple aggregations
- Always-fresh reporting needs
- Development/prototyping
When to Avoid:
- Complex transformations
- Frequently queried models
- Performance-critical queries
Table Materialization
When to Use: Dimensions, complex transformations, frequently queried models
{{ config(
materialized='table',
cluster_by=['order_date'] -- Snowflake optimization
) }}
select
customer_id,
customer_name,
count(distinct order_id) as lifetime_orders,
sum(order_amount) as lifetime_value,
min(order_date) as first_order_date
from {{ ref('stg_customers') }} c
join {{ ref('stg_orders') }} o using (customer_id)
group by customer_id, customer_name
How it Works:
- Drops and recreates table on every run (DROP + CREATE TABLE AS)
- Full refresh every time
- Fast query performance
- Higher storage cost
Best For:
- Dimension tables
- Gold layer marts
- Complex silver layer transformations
- Models with frequent queries
Performance Optimization:
{{ config(
materialized='table',
cluster_by=['date_column', 'category'], -- Snowflake clustering
snowflake_warehouse='LARGE_WH' -- Custom warehouse for complex logic
) }}
Incremental Materialization
When to Use: Large fact tables (millions+ rows), time-series data, event logs, append-only data
{{ config(
materialized='incremental',
unique_key='order_id',
incremental_strategy='merge',
merge_exclude_columns=['dbt_inserted_at'],
cluster_by=['order_date', 'customer_id']
) }}
select
order_id,
customer_id,
order_date,
order_amount,
order_status,
{% if is_incremental() %}
dbt_inserted_at, -- Preserve from first insert
{% else %}
current_timestamp() as dbt_inserted_at,
{% endif %}
current_timestamp() as dbt_updated_at
from {{ ref('stg_orders') }}
{% if is_incremental() %}
-- Only process new/updated records
where order_date > (select max(order_date) from {{ this }})
{% endif %}
How it Works:
- First run: Loads all data (acts like table)
- Subsequent runs: Insert/update only new records
- Uses
Установить dbt-materializations в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл dbt-materializations?
Choosing and implementing dbt materializations (ephemeral, view, table, incremental, snapshots, Python models). Use this skill when deciding on materialization strategy, implementing incremental models, setting up snapshots for SCD Type 2 tracking, or creating Python models for machine learning workloads.
Как установить скилл dbt-materializations?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dbt-materializations запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic