Tomme / dbt-athena

The athena adapter plugin for dbt (https://getdbt.com)
Apache License 2.0
142 stars 79 forks source link

external_location makes run fail because of HIVE_PATH_ALREADY_EXISTS #9

Closed bmasciarelli closed 3 years ago

bmasciarelli commented 3 years ago

Hi!

I'm trying to use the "externallocation" propery but I get this error when second model runs, as it's trying to use same path again: **Target directory for table 'table'_ already exists**.

I've setted the propery on the dbt_project.yml at a project level. If I set it at a model level, it works the first time but on the second run, i get the same error.

Am i doing something wrong?

For what i've seen, when using the default path, final table path is generated using a UUID but when overriding it, this UUID is not used.

Thanks in advance!

Tomme commented 3 years ago

Hey @bmasciarelli,

Apologies for the delay in my response. You are encountering this issue since you are using a static value for external_location. I would advise using a dynamic value if possible (similar to how default path is working with UUID).

Example dynamic values:

I have updated the README.md to reflect this recommendation so thank you for bring this to my attention 👍

Lastly, I do not automatically append a UUID to a custom external_location value, since I want to give flexiblity to the users of the adapter.

Tomme

bmasciarelli commented 3 years ago

No worries Tomme, thanks for the clarification and the amazing work you've done.