-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-1824] Add MetaData exploration to JDBC Interpreter #1776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable
| try { | ||
| closeDBPool(user, propertyKey); | ||
| } catch (SQLException e1) { | ||
| e1.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use logger, not to write to System.err
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connection can't be null here because we return at line 533 in case of null
ac3eb21 to
85124f5
Compare
|
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 |
|
The failed test looks to be from
|
097f06e to
b973d5f
Compare
|
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is javax.swing really required here?
|
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
6a6c7ad
Compare
|
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 #83 close #86 close #125 close #133 close #139 close #146 close #193 close #203 close #246 close #262 close #264 close #273 close #291 close #299 close #320 close #347 close #389 close #413 close #423 close #543 close #560 close #658 close #670 close #728 close #765 close #777 close #782 close #783 close #812 close #822 close #841 close #843 close #878 close #884 close #918 close #989 close #1076 close #1135 close #1187 close #1231 close #1304 close #1316 close #1361 close #1385 close #1390 close #1414 close #1422 close #1425 close #1447 close #1458 close #1466 close #1485 close #1492 close #1495 close #1497 close #1536 close #1545 close #1561 close #1577 close #1600 close #1603 close #1678 close #1695 close #1739 close #1748 close #1765 close #1767 close #1776 close #1783 close #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: