Closed surjansr closed 2 years ago
@cccs-jc I think I found the reason for the above bug. the spark SQL and trino magic both are defined to be line_cell_magic but the order of the arguments is different and hence trino is taking only the line argument when executing and ignoring the cell content and we are getting "No sql statement to execute"
def trino(self, cell=None, line=None, local_ns=None):
"Magic that works both as %trino and as %%trino"
self.set_user_ns(local_ns)
args = parse_argstring(self.trino, line)
def sparksql(self, line=None, cell=None, local_ns=None):
"Magic that works both as %sparksql and as %%sparksql"
self.set_user_ns(local_ns)
args = parse_argstring(self.sparksql, line)
output_file = self.outputFile or f"{os.path.expanduser('~')}/.local/sparkdb.schema.json"
output = args.output.lower()
@cccs-jc @cccs-nik : possible to put the fix in for this. For me the approval process will take time.
Sorry about that, I accidentally messed up the order of the args. Thanks for bringing up the issue and the fix 🙂Fix is merged.
When using
%%trino
it always errors out with syntax errorTrinoUserError: TrinoUserError(type=USER_ERROR, name=SYNTAX_ERROR, message="line 1:22: mismatched input '<EOF>'. Expecting: 'ALTER', 'ANALYZE', 'CALL', 'COMMENT', 'COMMIT', 'CREATE', 'DEALLOCATE', 'DELETE', 'DENY', 'DESC', 'DESCRIBE', 'DROP', 'EXECUTE', 'EXPLAIN', 'GRANT', 'INSERT', 'MERGE', 'PREPARE', 'REFRESH', 'RESET', 'REVOKE', 'ROLLBACK', 'SET', 'SHOW', 'START', 'TRUNCATE', 'UPDATE', 'USE', <query>", query_id=20220910_013206_00228_xf4wd)
using the same query with line magic works well which means the connections and other params are fine.
Inspecting the query being sent by %%trino , I see that the sql query is not even being passed to trino.
Logs