You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Yogesh Keshetty <yo...@outlook.com> on 2015/12/27 04:38:22 UTC

Sqlline Options

Hi,
We have a use  case where we have to run the same script for multiple tenants on different workspaces, so considering workspace as the variable which I want to pass the value from outside the script. Is it possible to do in SQLline? I have mentioned the hive example to explain my requirement. 
Example: In hive we use "hive -hivevar workspace='test' -f  test.sql " and inside test.sql we can refer to the variable "workspace" with ${hivevar:workspace} 
Is there anyway that we can use custom variables with Drill Sqlline?
Thank You,Yogesh 		 	   		  

Re: Sqlline Options

Posted by Christopher Matta <cm...@mapr.com>.
Hi Yogesh,
You could achieve this by writing a wrapper script:

#!/bin/env bash
VARIABLE="testvalue"

SQL="SELECT '${VARIABLE}' from sys.version;"

sqlline -u jdbc:drill: -n cmatta -p xxxx <<< $SQL

​

Chris Matta
cmatta@mapr.com
215-701-3146

On Sat, Dec 26, 2015 at 10:38 PM, Yogesh Keshetty <
yogesh.keshetty@outlook.com> wrote:

> Hi,
> We have a use  case where we have to run the same script for multiple
> tenants on different workspaces, so considering workspace as the variable
> which I want to pass the value from outside the script. Is it possible to
> do in SQLline? I have mentioned the hive example to explain my requirement.
> Example: In hive we use "hive -hivevar workspace='test' -f  test.sql " and
> inside test.sql we can refer to the variable "workspace" with
> ${hivevar:workspace}
> Is there anyway that we can use custom variables with Drill Sqlline?
> Thank You,Yogesh