Skip to content

Commit 13abbca

Browse files
committed
Make get_text return strings without quotes
1 parent fccf2bc commit 13abbca

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cratedb_sqlparse_py/cratedb_sqlparse/AstBuilder.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def enrich(self, stmt) -> None:
3232

3333
def visitTableName(self, ctx: SqlBaseParser.TableNameContext):
3434
fqn = ctx.qname()
35-
parts = self.get_text(fqn).replace('"', "").split(".")
35+
parts = self.get_text(fqn).split(".")
3636

3737
if len(parts) == 1:
3838
name = parts[0]
@@ -49,13 +49,13 @@ def visitGenericProperties(self, ctx: SqlBaseParser.GenericPropertiesContext):
4949
properties = {}
5050
interpolated_properties = {}
5151

52-
for property in node_properties:
53-
key = self.get_text(property.ident())
54-
value = self.get_text(property.expr())
52+
for property_ in node_properties:
53+
key = self.get_text(property_.ident())
54+
value = self.get_text(property_.expr())
5555

5656
properties[key] = value
5757

58-
if value[0] == "$":
58+
if value and value[0] == "$":
5959
# It might be a interpolated value, e.g. '$1'
6060
if value[1:].isdigit():
6161
interpolated_properties[key] = value
@@ -66,5 +66,5 @@ def visitGenericProperties(self, ctx: SqlBaseParser.GenericPropertiesContext):
6666
def get_text(self, node) -> t.Optional[str]:
6767
"""Gets the text representation of the node or None if it doesn't have one"""
6868
if node:
69-
return node.getText()
69+
return node.getText().replace("'", "").replace('"', "")
7070
return node

0 commit comments

Comments
 (0)