Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

how to use macros in qds.py api with hivecmd

43 views
Skip to first unread message

Chanchal Gupta

unread,
Feb 4, 2016, 12:23:20 AM2/4/16
to Qubole Public Forum
Hi Guys,

I am trying to use macros in qds.py api with hivecmd, but gettign below error, Can anybody help me out on this?

qds.py --token $tocken hivecmd run --cluster-label $cluster --macros='[{"scheme": "default", "table" : "employee"}]' --query desc '$scheme$'.'$table$'

Rajat Venkatesh

unread,
Feb 4, 2016, 1:03:19 AM2/4/16
to Chanchal Gupta, Qubole Public Forum
Macros is a list of hashes. Hash is {"variable":"value/expression"]. This is because the sequence of definitions is important. Change the argument to:
[{"scheme": "default"}, {"table" : "employee"}]
--
You received this message because you are subscribed to the Google Groups "Qubole Public Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qubole-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qubole-users/0509f794-162b-4947-9bff-578cac75bb4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chanchal Gupta

unread,
Feb 4, 2016, 11:00:56 PM2/4/16
to Qubole Public Forum, join.gupt...@gmail.com
no, its not working, I am getting below error:

qds.py --token $tocken hivecmd run --cluster-label $cluster --macros='[{"scheme": "tpds_stg"}, {"table" : "employee"}]' --query desc '$scheme$'.'$table$'

{"error":{"error_code":422,"error_message":"Parameters Error in evaluating scheme: ReferenceError: tpds_stg is not defined"}}

Rajat Venkatesh

unread,
Feb 5, 2016, 10:33:11 AM2/5/16
to Chanchal Gupta, Qubole Public Forum
Quoting hell! The problem is that the macros get converted to JavaScript assignment statements. So it is the equivalent of:
scheme=tpds_stg
table=employee

So it looks for a variable named tpds_stg. JavaScript expects quotes around it to treat it as a string.
Unfortunately I haven't been able to try the following out before suggesting the following:
'[{"scheme": "\'tpds_stg\'"}, {"table" : "\'employee\'"}]

Chanchal Gupta

unread,
Feb 5, 2016, 1:14:43 PM2/5/16
to Qubole Public Forum, join.gupt...@gmail.com
Thanks a lot guys, its working now, I have made couple of changes here....

qds.py --token $tocken hivecmd run --cluster-label $cluster --macros='[{"scheme": "\"tpds_stg\""}, {"table" : "\"employee\""}]' --query 'desc $scheme$.$table$'
Reply all
Reply to author
Forward
0 new messages