abhishekrb19 commented on code in PR #16677: URL: https://github.com/apache/druid/pull/16677#discussion_r1663024264
########## examples/bin/dsql-main-py3: ########## @@ -0,0 +1,518 @@ +#!/usr/bin/env python + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import argparse +import base64 +import collections +import csv +import errno +import json +import numbers +import os +import re +import readline +import ssl +import sys +import time +import unicodedata +import urllib.request +import urllib.error + +class DruidSqlException(Exception): + def friendly_message(self): + return getattr(self, 'message', 'Query failed') + + def write_to(self, f): + f.write('\x1b[31m') + f.write(self.friendly_message()) + f.write('\x1b[0m') + f.write('\n') + f.flush() + +def do_query_with_args(url, sql, context, args): + return do_query(url, sql, context, args.timeout, args.user, args.ignore_ssl_verification, args.cafile, args.capath, args.certchain, args.keyfile, args.keypass) + +def do_query(url, sql, context, timeout, user, ignore_ssl_verification, ca_file, ca_path, cert_chain, key_file, key_pass): + json_decoder = json.JSONDecoder(object_pairs_hook=collections.OrderedDict) + try: Review Comment: Sounds good, thanks @GWphua! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
