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
Error downloading dbt project files from s3 #25
Comments
I also ran a couple of times into a similar issue and realized it was caused by an empty file in S3, that when downloading, since it doesn't have a name, the hook assumes it has the same name as the root project directory (which already exists, and is a directory). You can verify if this is the case by doing a Regardless, given that you are reporting this, it appears to be more common than I thought, and it's not just me messing up when using the UI. So I'll write a quick patch as you suggested and skip s3 objects that are Thanks for reporting this! |
Look I just reproduced the issue by doing the following:
❯ aws s3 ls 's3://MYBUCKET/test/'
2021-12-15 19:08:37 0
2021-12-15 19:08:55 225 requirements.txt There it is! |
Thinking a bit more about it, the patch may have to also account for the fact that the empty file may be inside a sub-directory, so it will not be equal to the prefix. In the spirit of "better to ask for forgiveness than permission", we could just add a |
Thanks for replying so fast and being so open about the issue and your experience with it, and also for offering me to write the PR. Really appreciated! Awesome work on this repo btw! |
When passing an S3 URL to
project_dir
parameter, DbtS3Hook tries to download the root folder (prefix) as the temp dir throwing an exception.With
project_dir="s3://MYBUCKET.com/dbt"
I wasn't able to figure out why
airflow_dbt_python/hooks/s3.py
, line 98:Returns the prefix folder itself (
dbt/
) as one of the keys.Then
airflow_dbt_python/hooks/s3.py
, line 55, fails to open the file as it is actually a folder:By adding the following check after line 112, I was able to workaround the error.
The text was updated successfully, but these errors were encountered: