Skip to content
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

prehook sql throw exception #129

Open
lichenglin opened this issue Sep 14, 2022 · 5 comments
Open

prehook sql throw exception #129

lichenglin opened this issue Sep 14, 2022 · 5 comments

Comments

@lichenglin
Copy link

I wanted to excute a pre_hook query like this
{{ config(materialized='view',pre_hook="drop table if exists my_first_dbt_model") }}
But I found that in athena , the sql become
-- /* {"app": "dbt", "dbt_version": "1.2.1", "profile_name": "local", "target_name": "dev", "node_id": "model.dbtest.my_first_dbt_model"} */ drop table if exists my_first_dbt_model
since all the sql stay in one line , the sql had been miss as a comment , It failed

@hagai-arad
Copy link

@daniel-cortez-stevenson Hi, can this be related to #64?
If so, do you know how to fix it?

Thanks!

@daniel-cortez-stevenson
Copy link
Contributor

Yea must be - we can fix that

@nicor88
Copy link

nicor88 commented Nov 24, 2022

Removing -- from the comment doesn't fix all the cases, e.g. alter statement:

/* {"app": "dbt", "dbt_version": "1.3.0", "profile_name": "athena", "target_name": "dev", "node_id": "model.lakehouse.example_iceberg_increment"} */ ALTER TABLE silver.example_iceberg_increment SET TBLPROPERTIES ('vacuum_max_snapshot_age_seconds'='86400')

@daniel-cortez-stevenson
Copy link
Contributor

daniel-cortez-stevenson commented Nov 26, 2022

Appreciate the comment @nicor88 - after seeing this I thought that statements starting on the same line as the multi-line comment ends would be executed.

I wouldn't remove the -- , I'd add a newline after the annotation.

Do we agree that's a sufficient/wanted fix?

@nicor88
Copy link

nicor88 commented Nov 26, 2022

@daniel-cortez-stevenson feel free to open a PR here: https://github.com/dbt-athena/dbt-athena

The specific issue that I was having was cover by this pr: dbt-labs/dbt-athena#56 as somehow I thought as well to remove -- and add a new line \n was still leading to issue.

Anyhow, the development of Tomme/dbt-athena seems a bit stuck, the community did quite some progress on the new fork, have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants