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

Method _validate_database

shell/impala_shell/impala_shell.py:1211–1227  ·  view source on GitHub ↗

Issues a "USE " command where is the current database. It is typically needed after the connection is (re-)established to the Impala daemon. If immediately is False, it appends the USE command to self.cmdqueue. If immediately is True, it executes the USE command right away.

(self, immediately=False)

Source from the content-addressed store, hash-verified

1209 self._validate_database()
1210
1211 def _validate_database(self, immediately=False):
1212 """ Issues a "USE <db>" command where <db> is the current database.
1213 It is typically needed after the connection is (re-)established to the Impala daemon.
1214
1215 If immediately is False, it appends the USE command to self.cmdqueue.
1216 If immediately is True, it executes the USE command right away.
1217 """
1218 if not self.imp_client.connected:
1219 return
1220 # Should only check if successfully connected.
1221 if self.current_db:
1222 self.current_db = self.current_db.strip('`')
1223 use_current_db = ('use `%s`' % self.current_db)
1224 if immediately:
1225 self.onecmd(use_current_db)
1226 else:
1227 self.cmdqueue.append(use_current_db + ImpalaShell.CMD_DELIM)
1228
1229 def _print_if_verbose(self, message, file_descriptor=sys.stderr, flush=True):
1230 if self.verbose:

Callers 4

__init__Method · 0.95
precmdMethod · 0.95
do_connectMethod · 0.95

Calls 2

onecmdMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected