-
Notifications
You must be signed in to change notification settings - Fork 42
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
Some improvements to parsing when using normalize_names=True. #228
Some improvements to parsing when using normalize_names=True. #228
Conversation
@@ -238,7 +238,7 @@ def p_id(self, p): | |||
delimiters_to_end = ["`", '"', "]"] | |||
p[0] = p[1] | |||
|
|||
if self.normalize_names: | |||
if self.normalize_names and len(p[0]) > 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was causing []
to be removed, which are needed in statements like decimal(21)[]
@@ -221,7 +221,7 @@ def process_type(self, _type: Union[str, List], p_list: List, p: List) -> str: | |||
p[0] = {"property": {"distkey": True}} | |||
_type = _type.split("distkey")[0] | |||
|
|||
_type = _type.strip().replace('" . "', '"."') | |||
_type = _type.strip().replace(" . ", ".") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of a reason to want to keep the space around the dots if the strings are unquoted, so i simplified to this. This then allows the PR i'm about to make to omymodels pass existing tests....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, looks like it was 'historical context'
@cfhowes thanks for PR! merged |
@cfhowes released version 1.0.1 |
I found some issues when using normalize_names=True that I wanted to fix:
decimal(21)[]
would have the final[]
removed since it was parsed as its own id by the parser."complex"."type"
tocomplex . type
would was surprising to other tools (omymodels...)