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

The Redshift dialect does not support iterations on an array with: x AS y AT z #2372

Closed
erdrix opened this issue Oct 4, 2023 · 0 comments · Fixed by #2373
Closed

The Redshift dialect does not support iterations on an array with: x AS y AT z #2372

erdrix opened this issue Oct 4, 2023 · 0 comments · Fixed by #2373
Assignees

Comments

@erdrix
Copy link

erdrix commented Oct 4, 2023

Fully reproducible code snippet

  • dialect: redshift

Code:

import sqlglot
sql_code = """
SELECT c_name,
       orders.o_orderkey AS orderkey,
       index AS orderkey_index
FROM customer_orders_lineitem c, c.c_orders AS orders AT index 
ORDER BY orderkey_index;
"""
expressions = sqlglot.parse(sql_code, read="redshift")

Output:

sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 5, Col: 56.
  y AS orderkey,
       index AS orderkey_index
FROM customer_orders_lineitem c, c.c_orders AS orders AT index 
ORDER BY orderkey_index;

Same for query:

SELECT attr as attribute_name, json_typeof(val) as value_type 
FROM customer_orders_lineitem c, UNPIVOT c.c_orders[0] AS val AT attr 
WHERE c_custkey = 9451;

Official Documentation

https://docs.aws.amazon.com/redshift/latest/dg/query-super.html#unnest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants