Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

how to see list of tables in phoenix using zepplin by using default %jdbc(phoenix)

avatar
Contributor

I started using %jdbc(phoenix) interpretor which is provided by default.

I am trying to see the list of tables by using

!tables

of phoenix , and getting the following error.

ERROR 601 (42P00): Syntax error. Unexpected char: '!' class org.apache.phoenix.exception.PhoenixParserException org.apache.phoenix.exception.PhoenixParserException.newException(PhoenixParserException.java:33) org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:118) org.apache.phoenix.jdbc.PhoenixStatement$PhoenixStatementParser.parseStatement(PhoenixStatement.java:1185) org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(PhoenixStatement.java:1268) org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1339) org.apache.zeppelin.jdbc.JDBCInterpreter.executeSql(JDBCInterpreter.java:356) org.apache.zeppelin.jdbc.JDBCInterpreter.interpret(JDBCInterpreter.java:442) org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:94) org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:341) org.apache.zeppelin.scheduler.Job.run(Job.java:176) org.apache.zeppelin.scheduler.ParallelScheduler$JobRunner.run(ParallelScheduler.java:162) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) java.util.concurrent.FutureTask.run(FutureTask.java:266) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745)
2 REPLIES 2

avatar
Super Guru

"!tables" is a feature of Sqlline, not Phoenix.

I don't believe Phoenix has a standard SQL syntax for listing tables (such as `show tables`). You would have to use the DatabaseMetaData API that JDBC provides. I am not sure if Zeppelin exposes that for you.

https://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getTables(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String[])

avatar
New Contributor

select DISTINCT("TABLE_NAME") from SYSTEM.CATALOG;

this works from zeppelin

,

select DISTINCT("TABLE_NAME") from SYSTEM.CATALOG;