Creates OptionParser and adds shell options (flags) Default values are loaded in initially
(defaults)
| 156 | |
| 157 | |
| 158 | def get_option_parser(defaults): |
| 159 | """Creates OptionParser and adds shell options (flags) |
| 160 | |
| 161 | Default values are loaded in initially |
| 162 | """ |
| 163 | |
| 164 | parser = OptionParser() |
| 165 | parser.add_option("-i", "--impalad", dest="impalad", |
| 166 | help="<host:port> of impalad to connect to \t\t") |
| 167 | parser.add_option("-b", "--kerberos_host_fqdn", dest="kerberos_host_fqdn", |
| 168 | help="If set, overrides the expected hostname of the Impalad's " |
| 169 | "kerberos service principal. impala-shell will check that " |
| 170 | "the server's principal matches this hostname. This may be " |
| 171 | "used when impalad is configured to be accessed via a " |
| 172 | "load-balancer, but it is desired for impala-shell to talk " |
| 173 | "to a specific impalad directly.") |
| 174 | parser.add_option("-q", "--query", dest="query", |
| 175 | help="Execute a query without the shell") |
| 176 | parser.add_option("-f", "--query_file", dest="query_file", |
| 177 | help="Execute the queries in the query file, delimited by ;." |
| 178 | " If the argument to -f is \"-\", then queries are read from" |
| 179 | " stdin and terminated with ctrl-d.") |
| 180 | parser.add_option("-k", "--kerberos", dest="use_kerberos", |
| 181 | action="store_true", help="Connect to a kerberized impalad") |
| 182 | parser.add_option("-o", "--output_file", dest="output_file", |
| 183 | help=("If set, query results are written to the " |
| 184 | "given file. Results from multiple semicolon-terminated " |
| 185 | "queries will be appended to the same file")) |
| 186 | parser.add_option("-B", "--delimited", dest="write_delimited", |
| 187 | action="store_true", |
| 188 | help="Output rows in delimited mode") |
| 189 | parser.add_option("--print_header", dest="print_header", |
| 190 | action="store_true", |
| 191 | help="Print column names in delimited mode" |
| 192 | " when pretty-printed.") |
| 193 | parser.add_option("-E", "--vertical", |
| 194 | dest="vertical", |
| 195 | action="store_true", |
| 196 | help="Print the output of a query (rows) vertically.") |
| 197 | parser.add_option("--output_delimiter", dest="output_delimiter", |
| 198 | help="Field delimiter to use for output in delimited mode") |
| 199 | parser.add_option("-s", "--kerberos_service_name", |
| 200 | dest="kerberos_service_name", |
| 201 | help="Service name of a kerberized impalad") |
| 202 | parser.add_option("-V", "--verbose", dest="verbose", |
| 203 | action="store_true", |
| 204 | help="Verbose output") |
| 205 | parser.add_option("-p", "--show_profiles", dest="show_profiles", |
| 206 | action="store_true", |
| 207 | help="Always display query profiles after execution") |
| 208 | parser.add_option("--profile_output", dest="profile_output", |
| 209 | help="If set, query profiles will be written to the " |
| 210 | "given file. Profiles for multiple semicolon-terminated " |
| 211 | "queries will be appended to the same file") |
| 212 | parser.add_option("--profile_format", dest="profile_format", default="STRING", |
| 213 | help="Query profile format. Valid inputs are " |
| 214 | "['string', 'base64', 'json']. Format base64 " |
| 215 | "is compatible with impala-profile-tool.") |
no test coverage detected