Repository: phoenix Updated Branches: refs/heads/master 5df1b728e -> fefc319c9
PHOENIX-1733: sqlline.py doesn't allow connecting with a tenant-specific connection Signed-off-by: Gabriel Reid <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fefc319c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fefc319c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fefc319c Branch: refs/heads/master Commit: fefc319c98339d7da0b4105ee6f396d33128c45c Parents: 5df1b72 Author: Abhishek Sreenivasa <[email protected]> Authored: Thu Apr 16 12:57:26 2015 -0700 Committer: Gabriel Reid <[email protected]> Committed: Sun Apr 19 21:26:29 2015 +0200 ---------------------------------------------------------------------- bin/phoenix_utils.py | 16 +++++++++++++++- bin/psql.py | 6 +----- bin/sqlline.py | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/fefc319c/bin/phoenix_utils.py ---------------------------------------------------------------------- diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py index 182cdf3..7ef8d96 100755 --- a/bin/phoenix_utils.py +++ b/bin/phoenix_utils.py @@ -20,7 +20,6 @@ ############################################################################ import os -import sys import fnmatch def find(pattern, classPaths): @@ -95,3 +94,18 @@ def setPath(): testjar = find(PHOENIX_TESTS_JAR_PATTERN, phoenix_class_path) return "" + +def shell_quote(args): + """ + Return the platform specific shell quoted string. Handles Windows and *nix platforms. + + :param args: array of shell arguments + :return: shell quoted string + """ + if os.name == 'nt': + import subprocess + return subprocess.list2cmdline(args) + else: + # pipes module isn't available on Windows + import pipes + return " ".join([pipes.quote(v) for v in args]) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/fefc319c/bin/psql.py ---------------------------------------------------------------------- diff --git a/bin/psql.py b/bin/psql.py index 247001a..5b26dcd 100755 --- a/bin/psql.py +++ b/bin/psql.py @@ -26,11 +26,7 @@ import phoenix_utils phoenix_utils.setPath() -if os.name == 'nt': - args = subprocess.list2cmdline(sys.argv[1:]) -else: - import pipes # pipes module isn't available on Windows - args = " ".join([pipes.quote(v) for v in sys.argv[1:]]) +args = phoenix_utils.shell_quote(sys.argv[1:]) # HBase configuration folder path (where hbase-site.xml reside) for # HBase/Phoenix client side property override http://git-wip-us.apache.org/repos/asf/phoenix/blob/fefc319c/bin/sqlline.py ---------------------------------------------------------------------- diff --git a/bin/sqlline.py b/bin/sqlline.py index f48e527..2b2750a 100755 --- a/bin/sqlline.py +++ b/bin/sqlline.py @@ -46,7 +46,7 @@ localhost:2181:/hbase ../examples/stock_symbol.sql" sqlfile = "" if len(sys.argv) > 2: - sqlfile = "--run=" + sys.argv[2] + sqlfile = "--run=" + phoenix_utils.shell_quote([sys.argv[2]]) colorSetting = "true" # disable color setting for windows OS @@ -57,7 +57,7 @@ java_cmd = 'java -cp "' + phoenix_utils.hbase_conf_path + os.pathsep + phoenix_u '" -Dlog4j.configuration=file:' + \ os.path.join(phoenix_utils.current_dir, "log4j.properties") + \ " sqlline.SqlLine -d org.apache.phoenix.jdbc.PhoenixDriver \ --u jdbc:phoenix:" + sys.argv[1] + \ +-u jdbc:phoenix:" + phoenix_utils.shell_quote([sys.argv[1]]) + \ " -n none -p none --color=" + colorSetting + " --fastConnect=false --verbose=true \ --isolation=TRANSACTION_READ_COMMITTED " + sqlfile
