BigData Workflow Engine for Hadoop, Hbase, Netezza, Pig, Hive, Cascalog ...
Note: In all the examples ctx refer to the GlueContext in Workflow Process.
The SQL Result Objects returned are from the class (GroovyRowResult)[http://groovy.codehaus.org/api/groovy/sql/GroovyRowResult.html]
def file = ctx.sql.loadSql('mydb', 'select * from tbl')
ctx.sql.eachSqlResult('mydb', 'select name, age from people',
{ res ->
println "Name: ${res.name} age: ${res.age}"
}
//or in one line:
ctx.sql.eachSqlResult('mydb', 'select name, age from people',{ println "Name: ${it.name} age: ${it.age}" }
(def file (ctx-sql loadSql "mydb" "select * from tbl"))
(def results (map #(get % "name") (ctx-sql eachSqlResult "mydb" "select name, age from people")))
def file = ctx.sql().loadSql("mydb", "select * from tbl")
for rs in ctx.sql().eachSqlResult("mydb", "select name, age from people"):
print(str(rs))