Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions sqlglot/dialects/e6.py
Original file line number Diff line number Diff line change
Expand Up @@ -2509,23 +2509,23 @@ def not_sql(self, expression: exp.Not) -> str:
else:
return super().not_sql(expression)

def column_sql(self, expression: exp.Column) -> str:
"""
Override to skip table identifier when Star has an EXCEPT clause.

For E6 dialect, `table.* EXCEPT(col)` should become `* EXCEPT(col)`
without the table prefix.
"""
this = expression.args.get("this")

# Check if this column is inside a Star's except clause - skip table identifier
parent = expression.parent
if isinstance(parent, exp.Star) and parent.args.get("except"):
# Return only the column name without table prefix
return self.sql(this)

# Default behavior for all other cases
return super().column_sql(expression)
# def column_sql(self, expression: exp.Column) -> str:
# """
# Override to skip table identifier when Star has an EXCEPT clause.
#
# For E6 dialect, `table.* EXCEPT(col)` should become `* EXCEPT(col)`
# without the table prefix.
# """
# this = expression.args.get("this")
#
# # Check if this column is inside a Star's except clause - skip table identifier
# parent = expression.parent
# if isinstance(parent, exp.Star) and parent.args.get("except"):
# # Return only the column name without table prefix
# return self.sql(this)
#
# # Default behavior for all other cases
# return super().column_sql(expression)

def median_sql(self, expression: exp.Median):
if not self.SUPPORTS_MEDIAN:
Expand Down
12 changes: 6 additions & 6 deletions tests/dialects/test_e6.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def test_E6(self):
},
)

self.validate_all(
"SELECT r.* EXCEPT (_____dp_update_ts) FROM gold.ops.slp_fcc_gains_and_reasons AS r",
read={
"databricks": "select r.* except (r._____dp_update_ts) from gold.ops.slp_fcc_gains_and_reasons as r"
},
)
# self.validate_all(
# "SELECT r.* EXCEPT (_____dp_update_ts) FROM gold.ops.slp_fcc_gains_and_reasons AS r",
# read={
# "databricks": "select r.* except (r._____dp_update_ts) from gold.ops.slp_fcc_gains_and_reasons as r"
# },
# )

self.validate_all(
"SELECT REDUCE(ARRAY[1, 2, 3], 0, (acc, x) -> acc + x)",
Expand Down