feat: add Delta Lake Time Travel support to SQL parser#321
Open
DidelotK wants to merge 5 commits intoeddiethedean:mainfrom
Open
feat: add Delta Lake Time Travel support to SQL parser#321DidelotK wants to merge 5 commits intoeddiethedean:mainfrom
DidelotK wants to merge 5 commits intoeddiethedean:mainfrom
Conversation
Add support for Time Travel syntax in SQL queries, enabling queries that reference historical versions of tables: - VERSION AS OF <number> - TIMESTAMP AS OF '<timestamp>' - table@v<version> (Databricks shorthand) - table@<yyyyMMdd> (Databricks compact timestamp shorthand) Implementation: - Parser pre-processes queries to extract time travel syntax - Time travel info stored in components["time_travel"] - Query is processed with time travel stripped (mock returns current data) - Supports case-insensitive keywords In mock mode, time travel queries return current data (no real versioning). This allows code that uses time travel to run without errors while testing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused imports (cast, pytest, DataFrame) in test_sql_time_travel.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace `dict[str, Any] | None` with `Optional[Dict[str, Any]]` - Add missing typing imports (Optional, Tuple) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for Delta Lake Time Travel syntax in SQL queries, enabling queries that reference historical versions of tables. In mock mode, time travel queries return current data (no real versioning), allowing code that uses time travel to run without errors during testing.
Supported Syntax
Changes
parser.py):_extract_time_travel()helper method to parse time travel syntax_parse_select_query()to extract time travel info before main parsingcomponents["time_travel"]with:type: "version", "timestamp", or "timestamp_compact"value: The version number or timestamp stringtable: The base table nameImplementation Details
The implementation works by:
This approach allows:
Test Plan
Known Limitations
🤖 Generated with Claude Code