lmccay opened a new pull request #231: KNOX-2128 - Custom DataSource and SQL Commands for KnoxShell and KnoxShellTable URL: https://github.com/apache/knox/pull/231 (It is very **important** that you created an Apache Knox JIRA for this change and that the PR title/commit message includes the Apache Knox JIRA ID!) ## What changes were proposed in this pull request? As described in KIP-14 , GroovyShell allows for the extension of the shell itself with custom commands. By providing commands for the management of DataSource configuration and use in SQL queries, we can simplify the interaction with SQL engines and databases for JDBC-based database access in KnoxShell to make for a powerful scripting and shell environment. (Please fill in changes proposed in this fix) DataSource and SQL commands really go hand in hand here and will be done at the same time. * Datasources (:datasource|:ds) CRUD and select operations for a set of JDBC datasources that are persisted to disk in the user home directory * SQL (:SQL|:sql) SQL query execution with persisted SQL history per datasource ## How was this patch tested? Primarily tested new custom groovysh commands manually as writing tests is a bit challenging due to the lack of the groovysh environment within the tests. Will follow up with a patch for mocking that environment if possible. In order to test there are a few required steps that will need to be documented for general use as well: * download JDBC drivers and place in the {gateway-shell-home}/lib directory * add datasources for JDBC endpoints using ":ds add ds-name connectStr driverClass authn_type" where authn_type is "none" or "basic" * selecting the desired datasource is required only when there are more than one defined and is accomplished via ":ds select ds-name" * submitting a SQL query is done via the :SQL command ":sql". You may also include an "assign table-name" pair in the command line to indicate what variable name to set the resulting table to within the environment. This will launch a swing-based SQL Dialog for submitting the Query. This is necessary due to how GroovySh Custom Commands parse params from the command line. Where clauses or anything else that would require quotes don't work from the command line alone as the quotes are stripped and each word ends up being a separate param. * After submitting the query, the datasource authn_type is interrogated and the user is challenged for username and password when it is set as "basic" with another swing-based dialog box due to similar environment issues. Please review [Knox Contributing Process](https://cwiki.apache.org/confluence/display/KNOX/Contribution+Process#ContributionProcess-GithubWorkflow) before opening a pull request.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
