Member since
01-20-2017
8
Posts
1
Kudos Received
0
Solutions
02-08-2017
08:20 PM
Phys2 is EOL. https://github.com/BradRuderman/pyhs2/blob/1094d4b3a1e9032ee17eeb41f3381bbbd95862c1/README.md
... View more
02-08-2017
07:00 PM
I'm creating some python code to execute some beeline commands. The command looks ok, but I get an error:
WARNING: Use "yarn jar" to launch YARN applications.
Error: Error while compiling statement: FAILED: ParseException line 1:8
character '<EOF>' not supported here (state=42000,code=40000)
Error: Error while compiling statement: FAILED: ParseException line 1:12
character '<EOF>' not supported here (state=42000,code=40000)
['beeline', "-u 'jdbc:hive2://localhost:10000/default;principal=hive/dev15-namenode-01.example.com@example.COM'", '--fastConnect=true', '--showHeader=false', '--verbose=false', '--showWarnings=false', '--silent=true', '--outputFormat=csv2', "-e 'use tsz;'", "-e 'show tables;'"]
Traceback (most recent call last):
File "./beeline.py", line 55, in <module>
tables=beeline.show_tables()
File "./beeline.py", line 43, in show_tables
return self._run_cmd(cmd)
File "./beeline.py", line 48, in _run_cmd
stdout = subprocess.check_call(cmd)
File "/usr/lib64/python2.6/subprocess.py", line 505, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['beeline', "-u 'jdbc:hive2://localhost:10000/default;principal=hive/dev15-namenode-01.example.com@example.COM'", '--fastConnect=true', '--showHeader=false', '--verbose=false', '--showWarnings=false', '--silent=true', '--outputFormat=csv2', "-e 'use tsz;'", "-e 'show tables;'"]' returned non-zero exit status 2
The errors seem to correspond to the semicolons in the -e blocks. I know the command via the shell works. Any ideas on the cause? import os
import subprocess
class BeeLine(object):
"""Make empoyee person class with names, and title required."""
def __init__(self, principal, database, server='localhost', port=10000):
self.principal = principal
self.database = database
self.server = server
self.port = port
if not isinstance(port, (int, long)):
raise TypeError("Error, port must be an integer")
url=("'jdbc:hive2://" + server + ":" + str(port) + "/default;principal="
+ principal + "'")
self.options=[ "beeline"
, "-u " + url
, "--fastConnect=true"
, "--showHeader=false"
, "--verbose=false"
, "--showWarnings=false"
, "--silent=true"
]
def show_tables(self):
"""Show tables of object's database"""
cmd=[]
cmd.extend(self.options)
cmd.append("--outputFormat=csv2")
cmd.append("-e 'use " + self.database + ";'")
cmd.append("-e 'show tables;'")
return self._run_cmd(cmd)
def _run_cmd(self, cmd):
"""Private function. Run command, from array, and return stdout"""
print cmd
stdout = subprocess.check_call(cmd) <<<< Command run HERE
return stdout
#
# Main
#
beeline=BeeLine(
principal='hive/dev15-namenode-01.example.com@example.COM'
, database='tsz')
tables=beeline.show_tables()
print tables
... View more
Labels:
- Labels:
-
Apache Hive
01-20-2017
06:36 PM
I know how to get service configurations (e.g. /api/v1/clusters/dev15/configurations?type=<service>), but how can I instruct REST to restore an older config to the current config if I know the old config's tag or version?
... View more
Labels:
- Labels:
-
Apache Ambari