Skip to content

Commit

Permalink
fix update from select with using
Browse files Browse the repository at this point in the history
  • Loading branch information
ea-rus committed May 23, 2024
1 parent 7c731a1 commit 803bd05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions mindsdb_sql/parser/dialects/mindsdb/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class MindsDBParser(Parser):
'drop_dataset',
'union',
'select',
'select_using',
'insert',
'update',
'delete',
Expand Down Expand Up @@ -1090,7 +1089,7 @@ def ordering_term(self, p):
return OrderBy(field=p.identifier, direction='default')

@_('select USING kw_parameter_list')
def select_using(self, p):
def select(self, p):
p.select.using = p.kw_parameter_list
return p.select

Expand Down
4 changes: 3 additions & 1 deletion tests/test_parser/test_base_sql/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def test_update_simple(self, dialect):
from
(
select result, prod_id from table1
USING aaa = "bbb"
) as df
where
table2.prod_id = df.prod_id
Expand All @@ -68,7 +69,8 @@ def test_update_simple(self, dialect):
},
from_select=Select(
targets=[Identifier('result'), Identifier('prod_id')],
from_table=Identifier('table1')
from_table=Identifier('table1'),
using={'aaa': 'bbb'}
),
from_select_alias=Identifier('df'),
where=BinaryOperation(op='=', args=[
Expand Down

0 comments on commit 803bd05

Please sign in to comment.