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

Athena Dialect not fully supperted #5780

Open
2 of 3 tasks
fcavallaro-reply opened this issue Apr 18, 2024 · 1 comment
Open
2 of 3 tasks

Athena Dialect not fully supperted #5780

fcavallaro-reply opened this issue Apr 18, 2024 · 1 comment
Labels
athena Issues relating to the Athena dialect bug Something isn't working

Comments

@fcavallaro-reply
Copy link

fcavallaro-reply commented Apr 18, 2024

### Search before asking

  • I searched the issues and found no similar issues.

What Happened

Apparently sqlfluff is not able to parse Athena functions.

I am using sqlfluff with athena dialect on with dbt models using sql and jinja

Expected Behaviour

Sqlfluff parse correctly the .sql file

Observed Behaviour

Sqlfluff returns

Found unparsable section:

when finds Athena functions like:

BOTH, ON, GROUP and FROM (when used with WITHIN, for example in LISTAGG)

How to reproduce

For example: running the sqlfluff lint on a file containing

, composition AS (
   SELECT
     composition.material_number material_number_composition
   , LISTAGG(composition.composition, ' || ' ON OVERFLOW  ERROR) WITHIN GROUP (ORDER BY composition ASC) composition
   FROM
     {{ ref('article_composition') }} composition
   GROUP BY composition.material_number
`

Dialect

Athena

Version

sqlfluff = "~2.3.5"

Configuration

These are my sqlfluff configs specified in the pyproject.toml

[tool.sqlfluff.core]
dialect = "athena"
templater = "jinja"
runaway_limit = 10
indent_unit = "tab_space_size"
rules = "capitalisation.keywords"
large_file_skip_char_limit = 0
large_file_skip_byte_limit = 30000
sql_file_exts = ".sql"

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

@fcavallaro-reply fcavallaro-reply added the bug Something isn't working label Apr 18, 2024
@github-actions github-actions bot added the athena Issues relating to the Athena dialect label Apr 18, 2024
@robmcd
Copy link

robmcd commented May 17, 2024

Tested with SQLFluff 3.0.6. This is still broken.

Perhaps this issue is limited to the listagg function (which was added in Athena Engine v3)?
AWS documentation of listagg is here: https://trino.io/docs/current/functions/aggregate.html#listagg

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

No branches or pull requests

2 participants