Version 3.0.0 Proposal draft with sqlglot as the parsing library#617
Draft
Version 3.0.0 Proposal draft with sqlglot as the parsing library#617
Conversation
…qlglot parses it, so sqlglot produces a proper exp.Insert AST instead of exp.Command and parses it correctly without falling back to regex
…qlglot parses it, so sqlglot produces a proper exp.Insert AST instead of exp.Command and parses it correctly without falling back to regex
…ts from open issues to verify if it's handling the issues better than the old version, remove internal tokens and produce only list of strings if needed, remove compatibility layer to v1
…commodate additional 3 tests
…aults to simplify the bodies extraction
…switch to ruff for formating and linting
Collaborator
Author
|
@macbre started a proof of concept rewrite to replace quite stale and slow sqlparse with sqlglot as we had a convo with Toby some (quite long) time ago. Let me know how you feel about that in general? (The idea - not the code details yet) Seems we can close quite a lot of open issues, but replacing sqlparse was harder than I anticipated, as we do a lot of other things it seems. Note it's still a work in progress. Was also working on it with Claude but it required quite some iterations and manual fixes anyway. |
Owner
|
Sure, go for it 🚀 and welcome back! |
…er for now mark nocover as unreachable from parser and this is the only entrypoint we want for majority of the tests
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…es from queries with subscripts, some additional issues that were already fixed were documented by tests, some cleanup and refactor to decrease unreachable paths
…w star or star with table when prefixed with table name/alias - unreachable code
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.
---STILL WORK IN PROGRES---
Major rewrite of sql-metadata's parsing engine from token-based to sqlglot AST-based architecture (v3).
Refactor:
ARCHITECTURE.mdfileand keyword matching
single concern, composed by a thin Parser facade
Feature:
MERGEquery type supportAdmin:
Resolved issues
SEPARATORbeing parsed as a column #400parser.columns_dictdo not take into account subqueries. #528Disclaimer: The PR was written with a help of Claude althouth required a lot of manual fixes too ;)