You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using dbt-dremio to transform my data. When I run the drpzn_raw_data.sql model as a view or table it runs successfully as expected. But, when I try to do an incremental load the model fails with the error ERROR: Failure parsing the query.
When I look at the log I see
insert into "$scratch"."drpzn_raw_data"( )
select from "$scratch"."drpzn_raw_data__dbt_tmp"
[0m17:56:09.937084 [debug] [Thread-1 ]: dremio adapter: Job State = METADATA_RETRIEVAL
[0m17:56:09.950874 [debug] [Thread-1 ]: dremio adapter: Job State = FAILED
[0m17:56:09.951998 [debug] [Thread-1 ]: dremio adapter: Error running SQL: /* {"app": "dbt", "dbt_version": "1.4.5", "profile_name": "des_dbt", "target_name": "dev", "node_id": "model.des_dbt.drpzn_raw_data"} */
insert into "$scratch"."drpzn_raw_data"( )
select from "$scratch"."drpzn_raw_data__dbt_tmp"
Expected Behavior
for the first run drpzn_raw_data table should be populated with a unique_id '7d0f9875a72e865dd1fd77f28eacd145'
before the second run, in drpzn_source_data model, I change the columns for the md5 hash to
{%- set metadata_cols = ["file_ingest_datetime", "file_type", "file_name", "file_size", "bb"] -%}
another record should be added to drpzn_raw_data table with a different unique_id '28ea59d370a3bf65b7b8698f59f4bdd0'
Steps To Reproduce
to reproduce run the following models.
drpzn_source_data.sql
{% set drpzn_table_name = var('drpzn_table_name', 'edlhdata.daas.drpzn.file_agent."sample_json.json"') %}
{#- /* define metadata columns */ -#}
{%- set metadata_cols = ["file_ingest_datetime", "file_type", "file_name", "file_size"] -%}
SELECT
md5( {{ dbt.concat(metadata_cols) }} ) AS unique_id,
*,
{{ dbt_date.now("America/New_York") }} AS ingest_datetime
FROM {{ drpzn_table_name }}
drpzn_raw_data.sql
{{-
config(
materialized='incremental',
unique_key='unique_id',
incremental_strategy='append',
)
-}}
{%- set target_table_name = var('target_table_name', 'target') -%}
{#- /* get all columns from source data */ -#}
{%- set all_cols = adapter.get_columns_in_relation(ref("drpzn_source_data")) -%}
{#- /* define metadata columns */ -#}
{%- set metadata_cols = ["file_ingest_datetime", "file_type", "file_name", "file_size"] -%}
{#- /* get all columns except for metadata columns */-#}
{%- set final_cols = [] -%}
{%- for col in all_cols if col.name not in metadata_cols %}
{{- final_cols.append(col.name) or "" -}}
{%- endfor %}
SELECT
{%- for col in final_cols %}
{{ col }}{{ "," if not loop.last }}
{%- endfor %}
FROM {{ ref("drpzn_source_data") }}
{%- if is_incremental() %}
-- this filter will only be applied on an incremental run
where ingest_datetime > (select max(ingest_datetime) from {{ this }})
{%- endif %}
Thanks for bringing this to our attention, we will be looking into this issue. Our current priority is to update the connector to support dbt v1.5, and we will see if this bug is still reproducible once the connector has been upgraded.
Hi @raghuj5222,
I hit the same issue with the empty insert statement and I believe that it occurs when trying to insert incremental materializations into tables that are located in Dremio's $scratch directory. My model ran without issue after I changed the object store to an ADLS source in the dbt_project.yml:
Is there an existing issue for this?
Current Behavior
I am using dbt-dremio to transform my data. When I run the drpzn_raw_data.sql model as a view or table it runs successfully as expected. But, when I try to do an incremental load the model fails with the error ERROR: Failure parsing the query.
When I look at the log I see
Expected Behavior
for the first run drpzn_raw_data table should be populated with a unique_id '7d0f9875a72e865dd1fd77f28eacd145'
before the second run, in drpzn_source_data model, I change the columns for the md5 hash to
{%- set metadata_cols = ["file_ingest_datetime", "file_type", "file_name", "file_size", "bb"] -%}
another record should be added to drpzn_raw_data table with a different unique_id '28ea59d370a3bf65b7b8698f59f4bdd0'
Steps To Reproduce
to reproduce run the following models.
drpzn_source_data.sql
drpzn_raw_data.sql
Environment
Relevant log output
The text was updated successfully, but these errors were encountered: