Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is data returned in %jdbc paragraph available in subsequent paragraphs?

If a paragraph returns data from the %jdbc intepreter, is that data available to following paragraphs that use other interpreters?

eg

 %jdbc(psql)
 select * from `table`

then

 %python
 # load / access data here
 x = ...

In the same way that a %spark interpreter can create a temporal table, a following paragraph can run %sql.

like image 330
oracle certified professional Avatar asked Jul 18 '16 10:07

oracle certified professional


1 Answers

Apache Zeppelin has Generic JDBC Interpreter for connect to different data source with JDBC.

It lets you create a JDBC connection to any data source, by now it has been tested with:

  • Postgres
  • MySql
  • MariaDB
  • Redshift
  • Apache Hive
  • Apache Phoenix
  • Apache Drill

According to the code in org.apache.zeppelin.jdbc.JDBCInterpreter.executeSql, it only display the data.

So possible solution for getting data from a data source and use it in other interpreters could be.

  • Write a function use Scala with Spark interpreter. It connect to data source and generate DataFrame based on the query result.
  • Extend JDBCInterpreter, or create a new intepreter based on JDBCInterpreter which query towards the data source and generate DataFrame based on the result. This might require extend SQL syntax to add this feature.
like image 81
Rockie Yang Avatar answered Nov 05 '22 20:11

Rockie Yang