Skip to content

Commit 378a175

Browse files
haritamarclaude
andcommitted
Complete dbt-fusion Redshift temp table workaround
The previous fix (62b1122) only covered create_intermediate_relation(), but test materializations and other paths still created temp tables, causing the same ADBC 0.22 panic. This adds redshift__edr_get_create_table_as_sql() to intercept ALL temporary table creation in Redshift+fusion, creating regular tables instead. These are cleaned up by Elementary's normal cleanup logic. Fixes all remaining instances of: panic: "Either resolved_catalog or resolved_schema must be present" at fs/sa/crates/dbt-adapter/src/metadata/mod.rs:91:9 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 62b1122 commit 378a175

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

macros/utils/table_operations/create_table_as.sql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,23 @@
4646
as {{ sql_query }}
4747
{% endmacro %}
4848
49+
{% macro redshift__edr_get_create_table_as_sql(temporary, relation, sql_query) %}
50+
{% if temporary and elementary.is_dbt_fusion() %}
51+
{# Workaround for dbt-fusion 2.0.0-preview.104 ADBC 0.22 bug
52+
where metadata queries on temp tables return empty catalog/schema
53+
causing panic: "Either resolved_catalog or resolved_schema must be present"
54+
at fs/sa/crates/dbt-adapter/src/metadata/mod.rs:91:9
55+
56+
Create regular tables instead of temporary when using dbt-fusion.
57+
These will be cleaned up normally by Elementary's cleanup logic. #}
58+
create or replace table {{ relation }}
59+
as {{ sql_query }}
60+
{% else %}
61+
create {% if temporary %} temporary {% endif %} table {{ relation.include(database=(not temporary), schema=(not temporary)) }}
62+
as {{ sql_query }}
63+
{% endif %}
64+
{% endmacro %}
65+
4966
{% macro databricks__edr_get_create_table_as_sql(temporary, relation, sql_query) %}
5067
{% if temporary %}
5168
{% if elementary.is_dbt_fusion() %}

macros/utils/table_operations/has_temp_table_support.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828

2929
{% macro redshift__has_temp_table_support() %}
3030
{# Workaround for dbt-fusion 2.0.0-preview.104 ADBC 0.22 bug
31-
where get_columns_in_relation returns empty catalog/schema for temp tables
31+
where metadata queries on temp tables return empty catalog/schema
3232
causing panic: "Either resolved_catalog or resolved_schema must be present"
3333
at fs/sa/crates/dbt-adapter/src/metadata/mod.rs:91:9
3434

35-
This occurs intermittently during INSERT operations on temporary tables.
36-
Disabling temp tables for Redshift+fusion uses regular tables instead,
37-
which is slightly less efficient but avoids the panic.
35+
This disables temp tables for create_intermediate_relation(),
36+
and redshift__edr_get_create_table_as_sql() handles other paths
37+
that create temp tables (like test materializations).
3838

3939
Bug introduced in preview.104, not present in preview.102.
4040
TODO: Re-enable once dbt-fusion fixes this in a future release. #}

0 commit comments

Comments
 (0)