Snowflake Connector Error with New Materialization

I am facing the below error:

`2020-07-03 20:46:06.208650 (Thread-1): Writing injected SQL for node "model.dbt_from_scratch.reusable_type1_load"`
`2020-07-03 20:46:06.209600 (Thread-1): finished collecting timing info`
`2020-07-03 20:46:06.233872 (Thread-1): Unique Key is : None`
`2020-07-03 20:46:06.234081 (Thread-1): Date Column Name is : as_of_dt`
`2020-07-03 20:46:06.234191 (Thread-1): Target_Table_name is : TRUNC_AND_LOAD`
`2020-07-03 20:46:06.234290 (Thread-1): Source_Table_name is : CUSTOMER_TOTAL_ORDERS`
`2020-07-03 20:46:06.234381 (Thread-1): Identifier is : reusable_type1_load`
`2020-07-03 20:46:06.234742 (Thread-1): Current Relation type/status : True`
`2020-07-03 20:46:06.234873 (Thread-1): Current Relation is : "ANALYTICS_DB"."DBT"."TRUNC_AND_LOAD"`
`2020-07-03 20:46:06.259531 (Thread-1): Using snowflake connection "model.dbt_from_scratch.reusable_type1_load".`
`2020-07-03 20:46:06.259802 (Thread-1): On model.dbt_from_scratch.reusable_type1_load: /* {"app": "dbt", "dbt_version": "0.17.0", "profile_name": "dbt-snowflake-db", "target_name": "dev", "node_id": "model.dbt_from_scratch.reusable_type1_load"} */` `    describe table`
`2020-07-03 20:46:06.377164 (Thread-1): Snowflake query id: 0195539e-0142-4ee9-001c-ef830003b0e6`
`2020-07-03 20:46:06.377339 (Thread-1): Snowflake error: 001003 (42000): SQL compilation error:`
`syntax error line 1 at position 14 unexpected '<EOF>'.`
`2020-07-03 20:46:06.377527 (Thread-1): Error running SQL: macro get_columns_in_relation`
`2020-07-03 20:46:06.377626 (Thread-1): Rolling back transaction.`
`2020-07-03 20:46:06.377789 (Thread-1): finished collecting timing info`
`2020-07-03 20:46:06.378283 (Thread-1): Database Error in model reusable_type1_load (models/type1_load/reusable_type1_load.sql)`
`  001003 (42000): SQL compilation error:`

Materialization Code:

{% materialization type1_elt_load, adapter='snowflake' %}
    {% set unique_key = config.get('unique_key') %}
    {%- set date_col = config.get('date_col_name',default='as_of_dt') -%}
    {%- set target_table_name = config.get('target_table_name') -%}
    {%- set source_table_name = config.get('source_table_name') -%}
    {%- set trunc_load_flag = config.get('trunc_load_flag',default='false') -%}
    {%- set scd_type1_flag = config.get('scd_type1_flag',default='false') -%}
    {%- set del_insert_flag = config.get('del_insert_flag',default='false') -%}
    {%- set identifier = model['alias'] -%}
    --
    {{ log("Unique Key is : " ~ unique_key) }}
    {{ log("Date Column Name is : " ~ date_col) }}
    {{ log("Target_Table_name is : " ~ target_table_name) }}
    {{ log("Source_Table_name is : " ~ source_table_name) }}
    {{ log("Identifier is : " ~ identifier) }}
    --
    {%- set current_relation = adapter.get_relation(database=database, schema=schema, identifier=target_table_name) -%} 
    --
    {%- set current_relation_exists_as_table = (current_relation is not none and current_relation.is_table) -%}
    {{ log("Current Relation type/status : " ~ current_relation_exists_as_table) }}
    -- Raise exception if the table is missing
    {% if not current_relation %}
      {% do exceptions.warn("Unable to find the relation/table") %}
    {% else %}
      {{ log("Current Relation is : " ~ current_relation) }}
    {% endif %}
    -- setup
    {{ run_hooks(pre_hooks, inside_transaction=False) }}
    -- `BEGIN` happens here:
    {{ run_hooks(pre_hooks, inside_transaction=True) }}
    /*
    -- Call for trunc and load
    {% if trunc_load_flag %}
        {% set build_sql = type1_del(target_table_name,source_table_name,date_col,trunc_load_flag) %}
    {% endif %}
    --
    {{ log("Build SQL is : " ~ build_sql) }}
    --
    {% call statement("main") %}
      {{ build_sql }}
    {% endcall %}
    */
    {{ run_hooks(post_hooks, inside_transaction=True) }}
    -- `COMMIT` happens here
    {% do adapter.commit() %}
    {% for rel in to_drop %}
        {% do adapter.drop_relation(rel) %}
    {% endfor %}
    {{ run_hooks(post_hooks, inside_transaction=False) }}
    {{ return({'relations': [target_relation]}) }}
{% endmaterialization %}

Any help would be really appreciated. Thanks

2020-07-06 18:36:05.552681 (Thread-1): Compiling model.dbt_from_scratch.reusable_type1_load
2020-07-06 18:36:05.560846 (Thread-1): Writing injected SQL for node "model.dbt_from_scratch.reusable_type1_load"
2020-07-06 18:36:05.561458 (Thread-1): finished collecting timing info
2020-07-06 18:36:05.587726 (Thread-1): Unique Key is : None
2020-07-06 18:36:05.587926 (Thread-1): Date Column Name is : as_of_dt
2020-07-06 18:36:05.588086 (Thread-1): Target_Table_name is : TRUNC_AND_LOAD
2020-07-06 18:36:05.588217 (Thread-1): Source_Table_name is : CUSTOMER_TOTAL_ORDERS
2020-07-06 18:36:05.588312 (Thread-1): Identifier is : reusable_type1_load
2020-07-06 18:36:05.588672 (Thread-1): Current Relation type/status : True
2020-07-06 18:36:05.588823 (Thread-1): Current Relation is : "ANALYTICS_DB"."DBT"."TRUNC_AND_LOAD"
2020-07-06 18:36:05.596775 (Thread-1): Using snowflake connection "model.dbt_from_scratch.reusable_type1_load".
2020-07-06 18:36:05.596957 (Thread-1): On model.dbt_from_scratch.reusable_type1_load: BEGIN
2020-07-06 18:36:05.865981 (Thread-1): SQL status: SUCCESS 1 in 0.27 seconds
2020-07-06 18:36:05.866270 (Thread-1): Using snowflake connection "model.dbt_from_scratch.reusable_type1_load".
2020-07-06 18:36:05.866467 (Thread-1): On model.dbt_from_scratch.reusable_type1_load: /* {"app": "dbt", "dbt_version": "0.17.0", "profile_name": "dbt-snowflake-db", "target_name": "dev", "node_id": "model.dbt_from_scratch.reusable_type1_load"} */ insert into dbt_stg.load_audit values ( 'reusable_type1_load','executing model',current_timestamp )
2020-07-06 18:36:06.893529 (Thread-1): SQL status: SUCCESS 1 in 1.03 seconds
2020-07-06 18:36:06.910262 (Thread-1): Using snowflake connection "model.dbt_from_scratch.reusable_type1_load".
2020-07-06 18:36:06.910418 (Thread-1): On model.dbt_from_scratch.reusable_type1_load: /* {"app": "dbt", "dbt_version": "0.17.0", "profile_name": "dbt-snowflake-db", "target_name": "dev", "node_id": "model.dbt_from_scratch.reusable_type1_load"} */ describe table
2020-07-06 18:36:07.049920 (Thread-1): Snowflake query id: 019563fc-0157-5470-001c-ef830003832a
2020-07-06 18:36:07.050092 (Thread-1): Snowflake error: 001003 (42000): SQL compilation error:
syntax error line 1 at position 14 unexpected '<EOF>'.

No issues if i use default Materialization:

{{
config(
materialized=‘incremental’,
incremental_strategy=‘delete+insert’,
pre_hook=‘delete from {{this}}’,
alias=var(“target_table_name”)
)
}}

2020-07-06 18:32:33.780996 (Thread-1): Using snowflake connection "model.dbt_from_scratch.trunc_and_load".
2020-07-06 18:32:33.781098 (Thread-1): On model.dbt_from_scratch.trunc_and_load: /* {"app": "dbt", "dbt_version": "0.17.0", "profile_name": "dbt-snowflake-db", "target_name": "dev", "node_id": "model.dbt_from_scratch.trunc_and_load"} */ insert into dbt_stg.load_audit values ( 'TRUNC_AND_LOAD','executing model',current_timestamp )
2020-07-06 18:32:34.656922 (Thread-1): SQL status: SUCCESS 1 in 0.88 seconds
2020-07-06 18:32:34.658916 (Thread-1): Using snowflake connection "model.dbt_from_scratch.trunc_and_load".
2020-07-06 18:32:37.489437 (Thread-1): Using snowflake connection "model.dbt_from_scratch.trunc_and_load".
2020-07-06 18:32:37.489609 (Thread-1): On model.dbt_from_scratch.trunc_and_load: /* {"app": "dbt", "dbt_version": "0.17.0", "profile_name": "dbt-snowflake-db", "target_name": "dev", "node_id": "model.dbt_from_scratch.trunc_and_load"} */ describe table ANALYTICS_DB.DBT.TRUNC_AND_LOAD__dbt_tmp

Hi,

your sql seems invalid.
Take a look in the snowflake history to see the failing sql statement(s).
You can then backtrace this to dbt to resolve the issue.

Regards,
Marc