9

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.

  • looks like duplicated with https://stackoverflow.com/questions/44968803/zeppelin-sql-reuse-data-of-query-without-another-interpreter-or-a-new-query/45046993#45046993 I answered there. You can use spark sql programmatically. – 1ambda Jul 12 '17 at 01:48
  • 1
    @1ambda you didnt answer at all, here it's about "reuse" not "re-execute". Looks like the answer is nop, you cannot. Maybe with https://zeppelin.apache.org/docs/0.7.0/rest-api/rest-notebook.html#get-the-status-of-a-single-paragraph but it sounds hard and dirty. – Thomas Decaux Jul 17 '17 at 10:09
  • It's not for re-use. It's for how to create a table and access it in a programming language (python here). Did u read the title of the question? `in subsequent paragraphs` – 1ambda Jul 17 '17 at 12:17
  • The duplicated question / answer was removed and is not visible anymore. – Christophe Schmitz Jul 03 '19 at 05:54

1 Answers1

2

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.
Rockie Yang
  • 4,725
  • 31
  • 34
  • Thanks for your answer @RockieYang - unfortunately what you've given me is something I already know. What I need to know is how to access the data returned in a %jdbc paragraph from other paragraphs. – oracle certified professional Jul 18 '16 at 11:22
  • Yes. I did not realize it when I first post the answer. I added some possible solutions I could think of. – Rockie Yang Jul 18 '16 at 11:36