You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Christopher Matta <cm...@mapr.com> on 2014/11/19 18:55:11 UTC
sqlline returns 0 wether or not the query fails
I have two sql files:
good_query.sql
show databases;
bad_query.sql
show databaes;
I’m calling them with a sqlline alias: sqlline -f filename.sql, both the
good and bad file return 0 at the shell:
[root@ip-172-16-1-173 ~]# sqlline -f good_query.sql
1/1 show databases;
+-------------+
| SCHEMA_NAME |
+-------------+
| maprdb |
| cp.default |
| mfs.default |
| mfs.cmatta |
| mfs.nested |
| mfs.root |
| mfs.views |
| mfs.flat |
| sys |
| INFORMATION_SCHEMA |
+-------------+
10 rows selected (0.203 seconds)
Closing: org.apache.drill.jdbc.DrillJdbc41Factory$DrillJdbc41Connection
sqlline version 1.1.6
[root@ip-172-16-1-173 ~]# echo $?
0
[root@ip-172-16-1-173 ~]# sqlline -f bad_query.sql
1/1 show databaes;
Query failed: Failure while parsing sql : Encountered "show databaes"
at line 1, column 1.
Was expecting one of:
--snip--
Error: exception while executing query: Failure while executing query.
(state=,code=0)
Aborting command set because "force" is false and command failed:
"show databaes;"
Closing: org.apache.drill.jdbc.DrillJdbc41Factory$DrillJdbc41Connection
sqlline version 1.1.6
[root@ip-172-16-1-173 ~]# echo $?
0
For scripting purposes shouldn’t the bad query return 1?
Chris Matta
cmatta@mapr.com
215-701-3146