Skip to content

DuckDB iceberg_rest CTAS table materialization fails with __dbt_tmp already exists #14547

Description

@dataders

Summary

DuckDB iceberg_rest catalog attach works far enough for dbt seed, but dbt run table materialization fails during CTAS temp relation creation.

This blocks using an Iceberg REST catalog as a normal dbt model destination in the catalogs.yml v2 DuckDB flow.

related: duckdb/duckdb-iceberg#595

Repro

Using the dbt-fusion binary built from the dbt-labs/fs catalogs.yml v2 stack:

  • dbt-labs/fs#9420
  • dbt-labs/fs#9587

Configure an Iceberg REST catalog against local Lakekeeper:

catalogs:
  - name: iceberg_demo
    type: iceberg_rest
    table_format: iceberg
    config:
      duckdb:
        endpoint: "http://localhost:8181/catalog"
        warehouse: "demo"
        authorization_type: "NONE"
        access_delegation_mode: "NONE"
        attach_as: "iceberg_demo"

Then add a table model targeting that catalog:

{{ config(
    materialized='table',
    database='iceberg_demo'
) }}

select
  4 as demo_order,
  'iceberg_rest' as catalog_name,
  'lakekeeper + minio' as storage_type

Run:

RUST_LOG=debug /path/to/fs/target/debug/dbt run \
  --project-dir /path/to/jaffle-sandbox \
  --profiles-dir /path/to/jaffle-sandbox \
  --target catalog_showcase \
  --target-path /tmp/jaffle-target-9587 \
  --log-path /tmp/jaffle-logs-9587 \
  --select iceberg_rest_catalog_demo

Actual

The model fails while creating the dbt temp relation:

Invalid Configuration Error: Table iceberg_rest_catalog_demo__dbt_tmp already exists

Expected

materialized='table' should create or replace the target Iceberg table, or the adapter/materialization path should use an Iceberg-safe temp relation flow.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    adapter:duckdbConcerns the DuckDB adapter / SQL dialect.engine:v2Concerns the dbt Fusion (v2) engine.release/awaiting-releaseFix merged but not yet shipped in a releasestatus:needs-reproCannot proceed until the reporter provides a reproductiontype:bugA defect: Fusion behaves incorrectly versus expected/reference behavior.

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions