Skip to content

Commit

Permalink
support doublequoted table name
Browse files Browse the repository at this point in the history
  • Loading branch information
ea-rus committed Sep 20, 2024
1 parent 0f7a688 commit ba4613a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mindsdb_sql/parser/dialects/mindsdb/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1691,16 +1691,16 @@ def identifier(self, p):
node.parts += p[2].parts
return node

@_('id')
def identifier(self, p):
value = p[0]
return Identifier.from_path_str(value)

@_('quote_string',
'dquote_string')
def string(self, p):
return p[0]

@_('id', 'dquote_string')
def identifier(self, p):
value = p[0]
return Identifier.from_path_str(value)

@_('PARAMETER')
def parameter(self, p):
return Parameter(value=p.PARAMETER)
Expand Down
10 changes: 10 additions & 0 deletions tests/test_parser/test_base_sql/test_select_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,3 +1124,13 @@ def test_alternative_casting(self):
ast = parse_sql(sql)
assert str(ast) == str(expected_ast)

def test_table_double_quote(self):
expected_ast = Select(
targets=[Identifier('account_id')],
from_table=Identifier(parts=['order'])
)

sql = 'select account_id from "order"'

ast = parse_sql(sql)
assert str(ast) == str(expected_ast)

0 comments on commit ba4613a

Please sign in to comment.