-
Notifications
You must be signed in to change notification settings - Fork 28
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
View with column definition including "<expr> AS <alias>" (in SELECT) not parsed properly by converter #147
Comments
Wish we could find a way to extract VIEW text without relying on parsing. Maybe new REST API endpoints can do that, I'll take a look at some point. Otherwise the only way to do it reliably is to introduce actual SQL parsing. |
Yeah, I hear you. Was thinking of that StackOverflow post on parsing HTML with regexps. (And, yes, parsing SQL is Hard.) |
Ok, so, for what it's worth, making the following change to the regexp solved my one particular issue for this one particular view:
(Changed No telling what other damage I've caused. :) |
Upd in 0.36.0: applied your change, regexp looking for Naturally, it may still fail if I'll experiment with pyparsing soon and see if we can introduce more permanent solution. |
Fwiw, pyparsing docs: ignore(expr) - function to specify parse expression to be ignored while matching defined patterns; can be called repeatedly to specify multiple expressions; useful to specify patterns of comment syntax, for example |
Per note on #149 , this can be closed. |
Describe the bug
We have a view whose definition looks something like the following:
I believe the regular expression parsing this view is greedy and treats the second
AS
keyword as the beginning of the view definition, thus elidingSELECT
and everything that comes immediately after.I suspect the problem is in the greediness of this regexp: https://github.com/littleK0i/SnowDDL/blame/c7ca3c48a533340bc88ac690b6664840005093ec/snowddl/converter/view.py#L11
I'm still fiddling around, but my suspicions are pretty strong at this point.
Expected behavior
Full text of the view definition appears in the yaml generated by
snowddl-convert
.Attach log
(Later, if necessary.)
Attach YAML config (if applicable)
(No minimal reproduction at this time. Maybe later.)
The text was updated successfully, but these errors were encountered: