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

Function execute_queries_non_interactive_mode

shell/impala_shell/impala_shell.py:2137–2159  ·  view source on GitHub ↗

Run queries in non-interactive mode. Return True on success. Logs the error and returns False otherwise.

(options, query_options)

Source from the content-addressed store, hash-verified

2135
2136
2137def execute_queries_non_interactive_mode(options, query_options):
2138 """Run queries in non-interactive mode. Return True on success. Logs the
2139 error and returns False otherwise."""
2140 if options.query_file:
2141 # "-" here signifies input from STDIN
2142 if options.query_file == "-":
2143 query_text = sys.stdin.read()
2144 else:
2145 try:
2146 with open(options.query_file, 'r') as query_file_handle:
2147 query_text = query_file_handle.read()
2148 except Exception as e:
2149 print("Could not open file '%s': %s" % (options.query_file, e), file=sys.stderr)
2150 return False
2151 elif options.query:
2152 query_text = options.query
2153 else:
2154 return True
2155
2156 queries = parse_query_text(query_text)
2157 with ImpalaShell(options, query_options) as shell:
2158 return (shell.execute_query_list(shell.cmdqueue)
2159 and shell.execute_query_list(queries))
2160
2161
2162def get_intro(options):

Callers 1

impala_shell_mainFunction · 0.85

Calls 4

parse_query_textFunction · 0.85
execute_query_listMethod · 0.80
ImpalaShellClass · 0.70
readMethod · 0.45

Tested by

no test coverage detected