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

Supporting time travel parsing #2128

Closed
dmelchor-stripe opened this issue Aug 30, 2023 · 1 comment
Closed

Supporting time travel parsing #2128

dmelchor-stripe opened this issue Aug 30, 2023 · 1 comment
Assignees

Comments

@dmelchor-stripe
Copy link

Is your feature request related to a problem? Please describe.
Hi folks, we would love to be able to parse SQL statements that use time travel queries. Currently, trying to parse these results in an error.

Describe the solution you'd like
It would be great if exp.Table had a version/timestamp arg key. For example, for the query:

SELECT *
FROM example.testdb.customer_orders FOR VERSION AS OF 8954597067493422955

A syntax similar to:

(FROM this:
    (TABLE this:
      (IDENTIFIER this: customer_orders, quoted: False), db:
      (IDENTIFIER this: testdb, quoted: False), catalog:
      (IDENTIFIER this: example, quoted: False), version:
      (LITERAL this: 8954597067493422955, is_string: False)
))

And for the query:

SELECT *
FROM example.testdb.customer_orders FOR TIMESTAMP AS OF TIMESTAMP '2022-03-23 09:59:29.803 Europe/Vienna'

A syntax similar to:

(FROM this:
    (TABLE this:
      (IDENTIFIER this: customer_orders, quoted: False), db:
      (IDENTIFIER this: testdb, quoted: False), catalog:
      (IDENTIFIER this: example, quoted: False), timestamp:
      (CAST this:
          (LITERAL this: 2022-03-23 09:59:29.803 Europe/Vienna, is_string: True), to:
          (DATATYPE this: Type.TIMESTAMP, nested: False, prefix: False))
))

Describe alternatives you've considered
Currently, we are using regular expressions to find text matching time travel syntax and appending the version to the table name so that it can be parsed:

SELECT *
FROM example.testdb."customer_orders@8954597067493422955"

Additional context

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

No branches or pull requests

3 participants