-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to create snapshot of a model using dbt-trino==1.7.1 #386
Comments
I'm trying to reproduce this behaviour, but so far, I've had no luck. So, it fails exactly at but previously CREATE TABLE succeded, appending |
I was able to find a way around it by modifying the {% macro run_hooks(hooks, inside_transaction=True) %}
{% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}
{% if not inside_transaction and loop.first %}
{% call statement(auto_begin=inside_transaction) %}
commit;
{% endcall %}
{% endif %}
{% set rendered = render(hook.get('sql')) | trim | replace('"', '') %} -- to replace "" from table name
{% if (rendered | length) > 0 %}
{% call statement(auto_begin=inside_transaction) %}
{{ rendered }}
{% endcall %}
{% endif %}
{% endfor %}
{% endmacro %}
{% macro make_hook_config(sql, inside_transaction) %}
{{ tojson({"sql": sql, "transaction": inside_transaction}) }}
{% endmacro %}
{% macro before_begin(sql) %}
{{ make_hook_config(sql, inside_transaction=False) }}
{% endmacro %}
{% macro in_transaction(sql) %}
{{ make_hook_config(sql, inside_transaction=True) }}
{% endmacro %}
{% macro after_commit(sql) %}
{{ make_hook_config(sql, inside_transaction=False) }}
{% endmacro %} |
@damian3031 the above solution worked for my case, but is it the best way, or there is some other easier way, may be by updating some configurations - could not find alter way in docs :/ |
Expected behavior
Snapshot of model should be created.
The log should say something on the lines of:
1 of 1 OK snapshotted _<model_name>_......................................... [SUCCESS in 20.57s]
Actual behavior
Getting database error:
Actual query fired:
DROP TABLE IF EXISTS "<catalog_or_db_name>"."<schema_name>"."<model_name>"__dbt_tmp
Should have fired:
DROP TABLE IF EXISTS "<catalog_or_db_name>"."<schema_name>"."<model_name>__dbt_tmp"
Steps To Reproduce
Create a simple model and then a snapshot for that model.
dbt-core == 1.7.1
dbt-trino == 1.7.1
trino version == 438 [Should I bring it down to 435?]
Log output/Screenshots
Operating System
Mac OS 14 Sanoma
dbt version
1.7.1
Trino Server version
438
Python version
3.9.6
Are you willing to submit PR?
The text was updated successfully, but these errors were encountered: