Uh oh!
There was an error while loading. Please reload this page.
[ZEPPELIN-1824] Add MetaData exploration to JDBC Interpreter - #1776
[ZEPPELIN-1824] Add MetaData exploration to JDBC Interpreter#1776pmccaffrey6 wants to merge 36 commits into
Conversation
FireArrow
commented
Dec 16, 2016
LGTM. Test failure seems unrelated. |
| ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
| PrintStream ps = new PrintStream(baos); | ||
| e.printStackTrace(ps); | ||
| String errorMsg = new String(baos.toByteArray(), StandardCharsets.UTF_8); |
There was a problem hiding this comment.
As I remember, org.apache.commons.lang3.exception.ExceptionUtils#getStackTrace does the same thing
| String user = interpreterContext.getAuthenticationInfo().getUser(); | ||
| DatabaseMetaData dataBaseMetaData; | ||
| ResultSet resultSet = null; | ||
| ResultSetMetaData resultSetMetaData = null; |
| try { | ||
| closeDBPool(user, propertyKey); | ||
| } catch (SQLException e1) { | ||
| e1.printStackTrace(); |
There was a problem hiding this comment.
It's better to use logger, not to write to System.err
There was a problem hiding this comment.
Huge 👍 for using Logger here, as in the rest of the project
| resultSet.close(); | ||
| } catch (SQLException e) { /*ignored*/ } | ||
| } | ||
| if (connection != null) { |
There was a problem hiding this comment.
connection can't be null here because we return at line 533 in case of null
ac3eb21 to
85124f5Comparepmccaffrey6
commented
Dec 16, 2016
Hey guys, As for the other issues, I think they make a ton of sense. I wrote the Perhaps a good option would be to open a second PR to refactor the JDBC interpreter and make these changes in both |
pmccaffrey6
commented
Dec 17, 2016
The failed test looks to be from
|
097f06e to
b973d5fComparepmccaffrey6
commented
Dec 19, 2016
I went ahead and changed parsing of the "explore" keyword to use As an additional detail, if you look up a table that doesn't exist you'll just get an empty table in the paragraph as opposed to an explicit error message. I experimented a bit with testing for an empty result set using However, it seems that when getting metadata, since you're not using I don't imagine this is an issue really but if anyone has a suggestion of a good way to do this, I'd be very interested to hear it! |
| */ | ||
| package org.apache.zeppelin.jdbc; | ||
| import static javax.swing.plaf.basic.BasicHTML.propertyKey; |
Thank you @pmccaffrey6 , it looks great to me, modulo few things noted above. Could you please double check that all feedback from reviews was addressed? |
b973d5f to
6a6c7adComparepmccaffrey6
commented
Dec 20, 2016
Hey @bzz, As for the other excellent points that @DrIgor noted (including the great point about using logger), those issues are present both in As always, thanks for your review! |
close#83close#86close#125close#133close#139close#146close#193close#203close#246close#262close#264close#273close#291close#299close#320close#347close#389close#413close#423close#543close#560close#658close#670close#728close#765close#777close#782close#783close#812close#822close#841close#843close#878close#884close#918close#989close#1076close#1135close#1187close#1231close#1304close#1316close#1361close#1385close#1390close#1414close#1422close#1425close#1447close#1458close#1466close#1485close#1492close#1495close#1497close#1536close#1545close#1561close#1577close#1600close#1603close#1678close#1695close#1739close#1748close#1765close#1767close#1776close#1783close#1799
What is this PR for?
Zeppelin currently has little functionality for data source exploration. This PR exists to build a small feature for the JDBC interpreter that would allow users to explore metadata for databases and database objects.
With this PR, the JDBC interpreter accepts the "explore" keyword. When run in isolation, this fetches metadata about the database as a whole (tables, views etc...). When the explore keyword is followed by the name of a table or view, this fetches metadata about that table or view (column names, data types etc...).
A video of this feature in action can be found here (https://s3.amazonaws.com/screenshots-mockups/embedvid.html).
What type of PR is it?
Improvement | Feature
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1824
How should this be tested?
Run
explorein a%jdbcparagraph to get a list of tables, views, system tables, global and local temporary tables, aliases and synonyms.Run
explorefollowed by the name of a database table or view in order to get a list of column names, data types etc...Additionally, this PR adds two new unit tests to
JDBCInterpreterTestwhich test fetching of database metadata as well as table and view metadata.Screenshots (if appropriate)
https://s3.amazonaws.com/screenshots-mockups/embedvid.html
Questions: