I'm running a command to my containerized Hbase DB from the subprocess.run
function:
subprocess.run(('docker exec hbase bash -c "echo -e create "myTable", "R" | hbase shell"'), shell=True)
It seems that the command runs as I expected, it opens the HBase shell and then trying to execute the next command but without apostrophes: create myTable, R
The error I get:
2021-06-01 05:23:18,587 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.2.4, r67779d1a325a4f78a468af3339e73bf075888bac, 2020年 03月 11日 星期三 12:57:39 CST
Took 0.0032 seconds
stty: 'standard input': Inappropriate ioctl for device
create myTable, R
NameError: undefined local variable or method `myTable' for main:Object
HBase expects apostrophes around myTable
and R
.
I tried to run the same command prefixing the apostrophes with :
subprocess.run(('docker exec hbase bash -c "echo -e create \"myTable\", \"R\" | hbase shell"'), shell=True)
But I get the same results.
Any idea how can I prevent it from deleting the apostrophes? Thanks in advance!