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

Failing to parse some CREATE TABLE statements with generated columns #1681

Closed
bholzer opened this issue May 24, 2023 · 2 comments · Fixed by #1686
Closed

Failing to parse some CREATE TABLE statements with generated columns #1681

bholzer opened this issue May 24, 2023 · 2 comments · Fixed by #1686

Comments

@bholzer
Copy link

bholzer commented May 24, 2023

I am trying to parse table create statements used for Databricks, and they include generated columns. The example query from the Databricks documentation fails:

import sqlglot

q = """
CREATE TABLE default.people10m (
  id INT,
  firstName STRING,
  middleName STRING,
  lastName STRING,
  gender STRING,
  birthDate TIMESTAMP,
  dateOfBirth DATE GENERATED ALWAYS AS (CAST(birthDate AS DATE)),
  ssn STRING,
  salary INT
)
"""

sqlglot.parse_one(q, read="databricks")

sqlglot.errors.ParseError: Expecting ) on the AS of GENERATED ALWAYS AS

@georgesittas
Copy link
Collaborator

Thanks for the report, will take a look soon

@bholzer
Copy link
Author

bholzer commented May 25, 2023

Big thanks, impressive turnaround here 👍

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