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

Method do_use

shell/impala_shell/impala_shell.py:1654–1668  ·  view source on GitHub ↗

Executes a USE... query

(self, args)

Source from the content-addressed store, hash-verified

1652 return self._execute_stmt(query, print_web_link=True)
1653
1654 def do_use(self, args):
1655 """Executes a USE... query"""
1656 cmd_status = self._execute_stmt(
1657 self._build_query_string(self.last_leading_comment, self.orig_cmd, args))
1658 if cmd_status is CmdStatus.SUCCESS:
1659 self.current_db = args.strip('`').strip()
1660 self.set_prompt(self.current_db)
1661 elif args.strip('`') == self.current_db:
1662 # args == current_db means -d option was passed but the "use [db]" operation failed.
1663 # We need to set the current_db to None so that it does not show a database, which
1664 # may not exist.
1665 self.current_db = None
1666 return CmdStatus.ERROR
1667 else:
1668 return CmdStatus.ERROR
1669
1670 def do_show(self, args):
1671 """Executes a SHOW... query, fetching all rows"""

Callers

nothing calls this directly

Calls 3

_execute_stmtMethod · 0.95
_build_query_stringMethod · 0.95
set_promptMethod · 0.95

Tested by

no test coverage detected