Skip to content

Commit

Permalink
Add support for additional options
Browse files Browse the repository at this point in the history
  • Loading branch information
dacort committed Feb 13, 2020
1 parent fb02816 commit a77bcce
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ Please note:

If you need an example IAM policy for providing read-only access to your customer-base, check out the [Example IAM Policy](#example-iam-policy) below.

You can provide additional options if necessary. For example, to disable result set streaming and enable `TRACE`-level debugging, use `UseResultsetStreaming=0;LogLevel=6`.

Result set streaming is a performance optimization that streams results from Athena rather than using pagination logic, however it requries outbound access to TCP port 444 and not all organizations allow that.

Other options can be found in the "Driver Configuration Options" section of the [Athena JDBC Driver Installation and Configuration
Guide](https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.7/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf).

## Testing

There are two different sets of tests in the project.
Expand Down
4 changes: 4 additions & 0 deletions resources/metabase-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ driver:
- password
- name: secret_key
- display-name: Secret Key
- merge:
- additional-options
- display-name: Additional Athena connection string options
placeholder: 'UseResultsetStreaming=0;LogLevel=6'
init:
- step: load-namespace
namespace: metabase.driver.athena
Expand Down
21 changes: 12 additions & 9 deletions src/metabase/driver/athena.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[metabase.driver :as driver]
[metabase.driver.common :as driver.common]
[metabase.driver.sql-jdbc
[common :as sql-jdbc.common]
[connection :as sql-jdbc.conn]
[execute :as sql-jdbc.execute]
[sync :as sql-jdbc.sync]]
Expand Down Expand Up @@ -49,19 +50,21 @@
;;; ---------------------------------------------- sql-jdbc.connection -----------------------------------------------

(defmethod sql-jdbc.conn/connection-details->spec :athena [_ {:keys [region access_key secret_key s3_staging_dir workgroup db], :as details}]
(merge
{:classname "com.simba.athena.jdbc.Driver"
:subprotocol "awsathena"
:subname (str "//athena." region ".amazonaws.com:443")
:user access_key
:password secret_key
:s3_staging_dir s3_staging_dir
:workgroup workgroup
(-> (merge
{:classname "com.simba.athena.jdbc.Driver"
:subprotocol "awsathena"
:subname (str "//athena." region ".amazonaws.com:443")
:user access_key
:password secret_key
:s3_staging_dir s3_staging_dir
:workgroup workgroup
:AwsRegion region
; :LogLevel 6
}
(when (str/blank? access_key)
{:AwsCredentialsProviderClass "com.simba.athena.amazonaws.auth.DefaultAWSCredentialsProviderChain"})
(dissoc details :db)))
(dissoc details :db))
(sql-jdbc.common/handle-additional-options details, :seperator-style :semicolon)))

;;; ------------------------------------------------- sql-jdbc.sync --------------------------------------------------

Expand Down

0 comments on commit a77bcce

Please sign in to comment.