This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new a9fd540fef PHOENIX-7055 Small improvements and bug fixes to sqlline
a9fd540fef is described below

commit a9fd540fef2e4e1e5063b4ab914e250ee12d0d28
Author: Hari Dara <harid...@gmail.com>
AuthorDate: Thu Sep 28 16:56:49 2023 +0530

    PHOENIX-7055 Small improvements and bug fixes to sqlline
---
 bin/phoenix_utils.py |  8 +++++---
 bin/sqlline.py       | 17 ++++++++++++++---
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index de00f4efa9..404acc19ad 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -207,9 +207,11 @@ def shell_quote(args):
         return " ".join([pipes.quote(tryDecode(v)) for v in args])
 
 def common_sqlline_args(parser):
-    parser.add_argument('-v', '--verbose', help='Verbosity on sqlline.', 
default='true')
-    parser.add_argument('-c', '--color', help='Color setting for sqlline.', 
default='true')
-    parser.add_argument('-fc', '--fastconnect', help='Fetch all schemas on 
initial connection', default='false')
+    parser.add_argument('-v', '--verbose', help='Verbosity on sqlline.', 
action="store_true")
+    parser.add_argument('-c', '--color', help='Color setting for sqlline.', 
action="store_true")
+    parser.add_argument('-fc', '--fastconnect',
+                        help='Fetch all schemas on initial connection',
+                        action="store_true")
 
 if __name__ == "__main__":
     setPath()
diff --git a/bin/sqlline.py b/bin/sqlline.py
index 96ccdb6eb9..62f0814c9f 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -53,6 +53,11 @@ parser = argparse.ArgumentParser(description='Launches the 
Apache Phoenix Client
 parser.add_argument('zookeepers', nargs='?', help='The ZooKeeper quorum 
string', default='')
 # Positional argument 'sqlfile' is optional
 parser.add_argument('sqlfile', nargs='?', help='A file of SQL commands to 
execute', default='')
+parser.add_argument('--noconnect', help='Start without making a connection',
+                    action="store_true")
+parser.add_argument('--verbose-command',
+                    help='Show the Java command on the console before 
executing it',
+                    action="store_true")
 # Common arguments across sqlline.py and sqlline-thin.py
 phoenix_utils.common_sqlline_args(parser)
 # Parse the args
@@ -123,8 +128,14 @@ java_cmd = java + ' $PHOENIX_OPTS ' + \
     '" -Dlog4j2.configurationFile=file:' + 
os.path.join(phoenix_utils.current_dir, "log4j2.properties") + \
     disable_jna + \
     " sqlline.SqlLine -d org.apache.phoenix.jdbc.PhoenixDriver" + \
-    " -u jdbc:phoenix:" + phoenix_utils.shell_quote([zookeeper]) + \
-    " -n none -p none --color=" + colorSetting + " --fastConnect=" + 
tryDecode(args.fastconnect) + \
-    " --verbose=" + tryDecode(args.verbose) + " --incremental=false 
--isolation=TRANSACTION_READ_COMMITTED " + sqlfile
+    (not args.noconnect and " -u jdbc:phoenix:" + 
phoenix_utils.shell_quote([zookeeper]) or "") + \
+    " -n none -p none --color=" + \
+        (args.color and "true" or "false") + \
+        " --fastConnect=" + (args.fastconnect and "true" or "false") + \
+    " --verbose=" + (args.verbose and "true" or "false") + \
+        " --incremental=false --isolation=TRANSACTION_READ_COMMITTED " + 
sqlfile
+
+if args.verbose_command:
+    print("Executing java command: " + java_cmd)
 
 os.execl("/bin/sh", "/bin/sh", "-c", java_cmd)

Reply via email to