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

Automatically adding a comment to an Athena query provokes an error #2399

Closed
hereischris opened this issue Mar 19, 2018 · 4 comments
Closed
Labels

Comments

@hereischris
Copy link

hereischris commented Mar 19, 2018

Issue Summary

Hey there!
I am using Redash with Athena and it works great so far. Now I wanted to make redash execute the
MSCK REPAIR TABLE mydb.mytable; command (regularly). Redash executes the query, but automatically adds a a comment like this
/* Username: [email protected], Task ID: 7d6dasds21-dsa2c-47das2-a2sd7-400d4s2d270a, Query ID: 10, Queue: queries, Query Hash: dac8d6c15d934f51c2ab */

This command apparently makes the query fail with the message:
FAILED: ParseException line 1:0 cannot recognize input near '/' '*' 'Username'

I don't understand 100% why this happens. Other Athena queries work fine.
When I remove the command in AWS console, it works.
Any idea for quick fix?

Technical details:

  • Redash Version: Redash 3.0.0+b3134
  • Browser/OS: Chrome 64 / OS X
  • How did you install Redash: Via AMI Image
@quiver
Copy link

quiver commented Apr 21, 2018

I encountered the same problem and asked AWS support.
They said that Amazon Athena does not support /* */ comments for DDLs(MSCK, CREATE TABLE, etc.) at the moment and you should use -- style comments instead.

@quiver
Copy link

quiver commented Apr 24, 2018

Looks like setting env var ATHENA_ANNOTATE_QUERY to false suppresses the annotation.

@hereischris
Copy link
Author

Seems to work. Many thanks!!

@RichardLitt
Copy link

Thanks, both of you! Closing this for now.

daniel-cortez-stevenson pushed a commit to daniel-cortez-stevenson/dbt-external-tables that referenced this issue Feb 11, 2022
Assumes use of the https://github.com/Tomme/dbt-athena adapter

Considerations:
- `query-comment:` in `dbt_project.yml` must be set to nothing
    - Could be set to some other custom value
    - Standard block comment in dbt `/*...*/` is not supported in Athena
    - See getredash/redash#2399
- JSON in `./integration_tests/public_data/json/**/*.json` modified
    - Otherwise, fails integration test check for equal values
    - See https://github.com/rcongiu/Hive-JSON-Serde#json-data-files
- Piggybacks on the redshift macros for non-hive-compatible partitions
    - uses redshift helper macros because the query syntax is the same
    - we use a similar spec setup as Redshift for this reason

New env variables need to be set for CI:
- ATHENA_TEST_DBNAME
    - this is an AWS Glue "Data Source"
    - the schema is set to dbt_external_tables_integration_tests_athena
        - hardcoded like the other schemas in sample.profiles.yml
        - this is an AWS Glue "Database"
- AWS_REGION
- ATHENA_TEST_BUCKET
- ATHENA_TEST_WORKGROUP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants