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

[question] Is it possible to parse incomplete SQL? #224

Open
codeStryke opened this issue Jul 11, 2020 · 1 comment
Open

[question] Is it possible to parse incomplete SQL? #224

codeStryke opened this issue Jul 11, 2020 · 1 comment

Comments

@codeStryke
Copy link

I'm working on building a web-based SQL editor and we would like to implement an intelligent autocomplete. To that end, we would like to know if the cursor position in the string corresponds to a Table/Column/Keyword/Function in the SQL statement. Unfortunately, the user might still be writing the query and it will not be well-formed yet in the majority of the cases.

I'm wondering if this project might be able to handle a scenario like that?
Any suggestions and feedback are greatly appreciated. Thanks!

@nickolay
Copy link
Contributor

sqlparser's AST can only represent well-formed SQL. Fixing that (and supporting the editor use-case specifically) is one of the motivations for #189

Unfortunately, that work has seen very little progress and is currently in an early prototype stage. It should be easier, though, to fork it to achieve what you want, as ripping out the typed AST would immediately enable working with incomplete (chopped off) SQL and you can incrementally annotate the bits of the Syntax tree you need.

BTW you know of https://docs.gethue.com/developer/parsers/ , right?

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

2 participants