MCPcopy Create free account
hub / github.com/apache/impala / do_with

Method do_with

shell/impala_shell/impala_shell.py:1640–1652  ·  view source on GitHub ↗

Executes a query with a WITH clause, fetching all rows

(self, args)

Source from the content-addressed store, hash-verified

1638 self._build_query_string(self.last_leading_comment, self.orig_cmd, args))
1639
1640 def do_with(self, args):
1641 """Executes a query with a WITH clause, fetching all rows"""
1642 query = self._build_query_string(self.last_leading_comment, self.orig_cmd, args)
1643 # Parse the query with sqlparse to identify if it is a DML query or not.
1644 # Because the WITH clause may precede DML or SELECT queries, checking the
1645 # first string token is insufficient.
1646 parsed = sqlparse.parse(query)[0]
1647 query_type = sqlparse.sql.Statement(parsed.tokens).get_type()
1648 try:
1649 is_dml = self.DML_REGEX.match(query_type.lower())
1650 return self._execute_stmt(query, bool(is_dml), print_web_link=True)
1651 except ValueError:
1652 return self._execute_stmt(query, print_web_link=True)
1653
1654 def do_use(self, args):
1655 """Executes a USE... query"""

Callers

nothing calls this directly

Calls 5

_build_query_stringMethod · 0.95
_execute_stmtMethod · 0.95
matchMethod · 0.80
parseMethod · 0.45
get_typeMethod · 0.45

Tested by

no test coverage detected