Skip to content

Iceberg tables don't allow custom Materializations types #1313

@guru-pochineni

Description

@guru-pochineni

Describe the bug

When Iceberg tables are enabled with custom materialization types, dbt is explicitly checking if materialization is of types 'incremental', 'table', or 'snapshot' and erroing out. This works without any issues in delta format.

Steps To Reproduce

  1. Create a custom materialization type.
  2. Use the custom materialization type in a dbt model with table_format as iceberg.
  3. Run the dbt model.
Sample code

custom_table_materialization.sql

{% materialization custom_table_materialization, default %}
    {%- set target_relation = api.Relation.create(database=database, identifier=model['alias'], schema=schema, type='table') -%}

    {% set new_table_sql -%}
        {{ sql }}
    {%- endset %}

    {%- call statement('source_table_creation') -%}
        {{ dbt.create_table_as(False, target_relation, new_table_sql) }}
    {%- endcall -%}

    {{ return({'relations': [target_relation]}) }}

{%- endmaterialization %}

custom_mat_table.sql

{{
    config({
        "schema": var("core_silver_schema"),
        "materialized": "custom_table_materialization",
        "table_format": "iceberg",
        "file_format": "delta"
    })
}}

SELECT
    1 AS dummy_column

dbt_project.yml

.....
flags:
  use_managed_iceberg: true
  .....

Expected behavior

dbt model with custom materialization of iceberg type runs without any errors.

Screenshots and log output

Runtime Error in model custom_mat_tables (models/custom_mat_table.sql)
  When table_format is 'iceberg', materialized must be 'incremental', 'table', or 'snapshot'.

System information

The output of dbt --version:

Core:
  - installed: 1.11.2
  - latest:    1.11.2 - Up to date!

Plugins:
  - databricks: 1.11.4 - Up to date!
  - spark:      1.10.0 - Up to date!

The operating system you're using: macOS Tahoe: Version 26.2 (25C56)

The output of python --version: Python 3.12.11

Additional context

The problem appears to be a explicit check for these materializations in dbt create table macro. link

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions