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

Error Uploading results to dbt_artifacts.invocations #270

Closed
leeainscough opened this issue Feb 27, 2023 · 8 comments · Fixed by #299
Closed

Error Uploading results to dbt_artifacts.invocations #270

leeainscough opened this issue Feb 27, 2023 · 8 comments · Fixed by #299
Labels
bug Something isn't working

Comments

@leeainscough
Copy link

If I schedule a dbt job from within dbt cloud, the results of the invocations are uploaded without error.

However,if I call the dbt cloud job from airflow, the results being inserted into dbt_artifacts.invocations are throwing an error due to the escape sequences/single quotes within the message

example

Triggered via Apache Airflow by task 'trigger_dbt_cloud_job_run' in the airtable_ingest DAG.

Database Error
001003 (42000): SQL compilation error:
syntax error line 52 at position 170 unexpected 'trigger_dbt_cloud_job_run'.

    '{"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": true, "static_parser": true, "profiles_dir": "☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺.dbt", "send_anonymous_usage_stats": true, "event_buffer_size": 100000, "quiet": false, "no_print": false, "cache_selected_only": false, "profile": "user", "target": "default", "compile": true, "which": "generate", "rpc_method": "docs.generate", "indirect_selection": "eager"}', 
    '{"DBT_CLOUD_PROJECT_ID": "XXXX", "DBT_CLOUD_RUN_ID": "XXXXXX", "DBT_CLOUD_JOB_ID": "XXXXX", "DBT_CLOUD_RUN_REASON": "Triggered via Apache Airflow by task 'trigger_dbt_cloud_job_run' in the airtable_ingest DAG.", "DBT_CLOUD_RUN_REASON_CATEGORY": "other"}' 

)
@glsdown
Copy link
Contributor

glsdown commented Mar 31, 2023

Hi @leeainscough, thanks for raising this, and apologies for the delay in getting back to you.

Please could you let me know which version of dbt_artifacts you are using within your packages.yml file? If it is not the latest (2.2.2), please can you upgrade to the latest version and see if that resolves it. In the current version the single quotes look to be being escaped correctly, but I just want to check whether this behaviour is still occurring despite that or not.

Thanks!

@glsdown glsdown added bug Something isn't working question Further information is requested labels Mar 31, 2023
@leeainscough
Copy link
Author

leeainscough commented Mar 31, 2023 via email

@leeainscough
Copy link
Author

Hi Any updates on this?

To confirm, if my project is ran via dbt cloud scheduling it is fine.

If I orchestrate this from airflow, I get the about error when writing the results

@glsdown
Copy link
Contributor

glsdown commented Apr 24, 2023

I'm afraid I've not been able to replicate this behaviour myself. Please could you provide a minimal example which produces the error so that I can run against the same thing that you are seeing it in? Many thanks.

@leeainscough
Copy link
Author

leeainscough commented Apr 24, 2023 via email

@leeainscough
Copy link
Author

leeainscough commented Apr 25, 2023

I believe the very last part of the insert

"Triggered via Apache Airflow by task 'trigger_dbt_cloud_job_run' in the
airtable_ingest DAG.", "DBT_CLOUD_RUN_REASON_CATEGORY": "other"}'

needs to be wrapped as

"Triggered via Apache Airflow by task \'trigger_dbt_cloud_job_run\' in the
airtable_ingest DAG.", "DBT_CLOUD_RUN_REASON_CATEGORY": "other"}'

Thanks

@glsdown
Copy link
Contributor

glsdown commented Apr 28, 2023

Thanks for the extra detail. @danthelion was able to spot that it's related to the environment variable field rather than the dbt_cloud_run_reason field that I had been looking at. I've now been able to replicate it, and have created a PR which will hopefully help resolve this.

@glsdown glsdown removed the question Further information is requested label Apr 28, 2023
@leeainscough
Copy link
Author

Great - thankyou!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants