Runs a command in the Impala shell interactively.
(vector, input_lines, shell_args=None,
wait_until_connected=True)
| 1350 | |
| 1351 | |
| 1352 | def run_impala_shell_interactive(vector, input_lines, shell_args=None, |
| 1353 | wait_until_connected=True): |
| 1354 | """Runs a command in the Impala shell interactively.""" |
| 1355 | # if argument "input_lines" is a string, makes it into a list |
| 1356 | if type(input_lines) is str: |
| 1357 | input_lines = [input_lines] |
| 1358 | # workaround to make Popen environment 'utf-8' compatible |
| 1359 | # since piping defaults to ascii |
| 1360 | my_env = os.environ |
| 1361 | my_env['PYTHONIOENCODING'] = 'utf-8' |
| 1362 | p = ImpalaShell(vector, args=shell_args, env=my_env, |
| 1363 | wait_until_connected=wait_until_connected) |
| 1364 | for line in input_lines: |
| 1365 | LOG.info("Running %s" % line) |
| 1366 | p.send_cmd(line) |
| 1367 | return p.get_result() |
no test coverage detected