AnsweredAssumed Answered

Passing parameters while running SQL statements from a file or command line in Drill?

Question asked by sabamu28 on Apr 27, 2017
Latest reply on Apr 28, 2017 by arjunkr

We can use the following command to run sql from the command line in drill.

Running SQL statements from a file or command line in Drill 

One way is to put the SQL statements in a script and use the --run option for sqlline:

 

$ echo 'select count(*) from cp.`employee.json`;' > count_employees.sql

$ sqlline -u jdbc:drill:zk=localhost:2181 --run=count_employees.sql

1/1          select count(*) from cp.`employee.json`;

+---------+

| EXPR$0  |

+---------+

| 1155    |

+---------+

1 row selected (0.256 seconds)

 

If I have to send parameters to the SQL file, how can I do it? So in this example, if I have to send some values as parameters in "count_employees.sql"  file, how can I do that? mapr drill 

Outcomes