I'm trying to execute 'DELETE' query by Trino plugin and It fails. I suppose, jupiterhub plugin add some 'limit' to my query and this behavior affect execution. 'SELECT' query works fine. Also the same issue I have gotten when have executed 'UPDATE' and 'INSERT' queries.
My query:
%%trino
DELETE FROM delta.my_schema.jupiter_delta WHERE lang = 'Python'
Output message:
TrinoUserError Traceback (most recent call last)
Cell In[51], line 1
----> 1 get_ipython().run_cell_magic('trino', '', "DELETE FROM delta.my_schema.jupiter_delta WHERE lang = 'Scala'\n")
File /opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py:2422, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
2420 with self.builtin_trap:
2421 args = (magic_arg_s, cell)
-> 2422 result = fn(*args, **kwargs)
2423 return result
File /opt/conda/lib/python3.10/site-packages/jupyterlab_sql_editor/ipython_magic/trino/trino.py:119, in Trino.trino(self, line, cell, local_ns)
116 elif not args.raw is True:
117 sql = f'{sql} limit {limit+1}'
--> 119 self.cur.execute(sql)
120 results = self.cur.fetchmany(limit+1)
122 columns = list(map(lambda d: d[0], self.cur.description))
File /opt/conda/lib/python3.10/site-packages/trino/dbapi.py:439, in Cursor.execute(self, operation, params)
436 else:
437 self._query = trino.client.TrinoQuery(self._request, sql=operation,
438 experimental_python_types=self._experimental_pyton_types)
--> 439 result = self._query.execute()
440 self._iterator = iter(result)
441 return result
File /opt/conda/lib/python3.10/site-packages/trino/client.py:765, in TrinoQuery.execute(self, additional_http_headers)
763 # Execute should block until at least one row is received or query is finished or cancelled
764 while not self.finished and not self.cancelled and len(self._result.rows) == 0:
--> 765 self._result.rows += self.fetch()
766 return self._result
File /opt/conda/lib/python3.10/site-packages/trino/client.py:780, in TrinoQuery.fetch(self)
778 """Continue fetching data for the current query_id"""
779 response = self._request.get(self._request.next_uri)
--> 780 status = self._request.process(response)
781 self._update_state(status)
782 logger.debug(status)
File /opt/conda/lib/python3.10/site-packages/trino/client.py:581, in TrinoRequest.process(self, http_response)
579 logger.debug("HTTP %s: %s", http_response.status_code, response)
580 if "error" in response:
--> 581 raise self._process_error(response["error"], response.get("id"))
583 if constants.HEADER_CLEAR_SESSION in http_response.headers:
584 for prop in get_header_values(
585 http_response.headers, constants.HEADER_CLEAR_SESSION
586 ):
TrinoUserError: TrinoUserError(type=USER_ERROR, name=SYNTAX_ERROR, message="line 2:2: mismatched input 'limit'. Expecting: '%', '*', '+', '-', '.', '/', 'AND', 'AT', 'OR', '[', '||', ", query_id=20230111_132511_00024_k3w8w)