boB Rudis 1 year ago
parent
commit
6d888f1499
No known key found for this signature in database

+ 2
- 1
.Rbuildignore View File

@@ -8,5 +8,6 @@
8 8
 ^NOTES\.*html$
9 9
 ^\.codecov\.yml$
10 10
 ^README_files$
11
-^doc$
11
+^docs$
12 12
 ^CONDUCT\.md$
13
+^\.bash_profile

+ 12
- 14
DESCRIPTION View File

@@ -1,29 +1,27 @@
1
-Package: metis.lite
1
+Package: metis.jars
2 2
 Type: Package
3
-Title: Access and Query Amazon Athena via DBI/JDBC
4
-Version: 0.3.0
5
-Date: 2019-02-14
3
+Title: Amazon Athena JDBC Driver Wrapper Supporting the 'metis' Package
4
+Version: 2.0.6
5
+Date: 2019-02-17
6 6
 Authors@R: c(
7 7
     person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),
8 8
            comment = c(ORCID = "0000-0001-5670-2640"))
9 9
   )
10 10
 Maintainer: Bob Rudis <bob@rud.is>
11 11
 Encoding: UTF-8
12
-Description: Methods are provides to connect to 'Amazon' 'Athena', lookup schemas/tables,
13
-    perform queries and retrieve query results. A lightweight 'RJDBC' implementation 
14
-    is included along with additional helpers for 'dplyr'/'dplyr' suppprt.
12
+Description: Contents of the Amazon Athena JDBC Driver 
13
+    <https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html>
14
+    provided to support functions in the 'metis' package. Version number 
15
+    reflects the version number of the included 'JAR' file.
15 16
 SystemRequirements: JDK 1.8+
16
-License: MIT + file LICENSE
17
+License: Apache License (>= 2.0)
18
+Copyright: file inst/COPYRIGHTS
17 19
 Suggests:
18 20
     testthat,
19 21
     covr
20 22
 Depends:
21
-    R (>= 3.2.0),
22
-    RJDBC
23
+    R (>= 3.2.0)
23 24
 Imports:
24 25
     rJava,
25
-    DBI,
26
-    bit64,
27
-    dbplyr,
28
-    aws.signature
26
+    utils
29 27
 RoxygenNote: 6.1.1

+ 0
- 2
LICENSE View File

@@ -1,2 +0,0 @@
1
-YEAR: 2019
2
-COPYRIGHT HOLDER: Bob Rudis

+ 194
- 21
LICENSE.md View File

@@ -1,21 +1,194 @@
1
-# MIT License
2
-
3
-Copyright (c) 2019 Bob Rudis
4
-
5
-Permission is hereby granted, free of charge, to any person obtaining a copy
6
-of this software and associated documentation files (the "Software"), to deal
7
-in the Software without restriction, including without limitation the rights
8
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
-copies of the Software, and to permit persons to whom the Software is
10
-furnished to do so, subject to the following conditions:
11
-
12
-The above copyright notice and this permission notice shall be included in all
13
-copies or substantial portions of the Software.
14
-
15
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
-SOFTWARE.
1
+Apache License
2
+==============
3
+
4
+_Version 2.0, January 2004_
5
+_&lt;<http://www.apache.org/licenses/>&gt;_
6
+
7
+### Terms and Conditions for use, reproduction, and distribution
8
+
9
+#### 1. Definitions
10
+
11
+“License” shall mean the terms and conditions for use, reproduction, and
12
+distribution as defined by Sections 1 through 9 of this document.
13
+
14
+“Licensor” shall mean the copyright owner or entity authorized by the copyright
15
+owner that is granting the License.
16
+
17
+“Legal Entity” shall mean the union of the acting entity and all other entities
18
+that control, are controlled by, or are under common control with that entity.
19
+For the purposes of this definition, “control” means **(i)** the power, direct or
20
+indirect, to cause the direction or management of such entity, whether by
21
+contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
22
+outstanding shares, or **(iii)** beneficial ownership of such entity.
23
+
24
+“You” (or “Your”) shall mean an individual or Legal Entity exercising
25
+permissions granted by this License.
26
+
27
+“Source” form shall mean the preferred form for making modifications, including
28
+but not limited to software source code, documentation source, and configuration
29
+files.
30
+
31
+“Object” form shall mean any form resulting from mechanical transformation or
32
+translation of a Source form, including but not limited to compiled object code,
33
+generated documentation, and conversions to other media types.
34
+
35
+“Work” shall mean the work of authorship, whether in Source or Object form, made
36
+available under the License, as indicated by a copyright notice that is included
37
+in or attached to the work (an example is provided in the Appendix below).
38
+
39
+“Derivative Works” shall mean any work, whether in Source or Object form, that
40
+is based on (or derived from) the Work and for which the editorial revisions,
41
+annotations, elaborations, or other modifications represent, as a whole, an
42
+original work of authorship. For the purposes of this License, Derivative Works
43
+shall not include works that remain separable from, or merely link (or bind by
44
+name) to the interfaces of, the Work and Derivative Works thereof.
45
+
46
+“Contribution” shall mean any work of authorship, including the original version
47
+of the Work and any modifications or additions to that Work or Derivative Works
48
+thereof, that is intentionally submitted to Licensor for inclusion in the Work
49
+by the copyright owner or by an individual or Legal Entity authorized to submit
50
+on behalf of the copyright owner. For the purposes of this definition,
51
+“submitted” means any form of electronic, verbal, or written communication sent
52
+to the Licensor or its representatives, including but not limited to
53
+communication on electronic mailing lists, source code control systems, and
54
+issue tracking systems that are managed by, or on behalf of, the Licensor for
55
+the purpose of discussing and improving the Work, but excluding communication
56
+that is conspicuously marked or otherwise designated in writing by the copyright
57
+owner as “Not a Contribution.”
58
+
59
+“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
60
+of whom a Contribution has been received by Licensor and subsequently
61
+incorporated within the Work.
62
+
63
+#### 2. Grant of Copyright License
64
+
65
+Subject to the terms and conditions of this License, each Contributor hereby
66
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
67
+irrevocable copyright license to reproduce, prepare Derivative Works of,
68
+publicly display, publicly perform, sublicense, and distribute the Work and such
69
+Derivative Works in Source or Object form.
70
+
71
+#### 3. Grant of Patent License
72
+
73
+Subject to the terms and conditions of this License, each Contributor hereby
74
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
75
+irrevocable (except as stated in this section) patent license to make, have
76
+made, use, offer to sell, sell, import, and otherwise transfer the Work, where
77
+such license applies only to those patent claims licensable by such Contributor
78
+that are necessarily infringed by their Contribution(s) alone or by combination
79
+of their Contribution(s) with the Work to which such Contribution(s) was
80
+submitted. If You institute patent litigation against any entity (including a
81
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
82
+Contribution incorporated within the Work constitutes direct or contributory
83
+patent infringement, then any patent licenses granted to You under this License
84
+for that Work shall terminate as of the date such litigation is filed.
85
+
86
+#### 4. Redistribution
87
+
88
+You may reproduce and distribute copies of the Work or Derivative Works thereof
89
+in any medium, with or without modifications, and in Source or Object form,
90
+provided that You meet the following conditions:
91
+
92
+* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
93
+this License; and
94
+* **(b)** You must cause any modified files to carry prominent notices stating that You
95
+changed the files; and
96
+* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
97
+all copyright, patent, trademark, and attribution notices from the Source form
98
+of the Work, excluding those notices that do not pertain to any part of the
99
+Derivative Works; and
100
+* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
101
+Derivative Works that You distribute must include a readable copy of the
102
+attribution notices contained within such NOTICE file, excluding those notices
103
+that do not pertain to any part of the Derivative Works, in at least one of the
104
+following places: within a NOTICE text file distributed as part of the
105
+Derivative Works; within the Source form or documentation, if provided along
106
+with the Derivative Works; or, within a display generated by the Derivative
107
+Works, if and wherever such third-party notices normally appear. The contents of
108
+the NOTICE file are for informational purposes only and do not modify the
109
+License. You may add Your own attribution notices within Derivative Works that
110
+You distribute, alongside or as an addendum to the NOTICE text from the Work,
111
+provided that such additional attribution notices cannot be construed as
112
+modifying the License.
113
+
114
+You may add Your own copyright statement to Your modifications and may provide
115
+additional or different license terms and conditions for use, reproduction, or
116
+distribution of Your modifications, or for any such Derivative Works as a whole,
117
+provided Your use, reproduction, and distribution of the Work otherwise complies
118
+with the conditions stated in this License.
119
+
120
+#### 5. Submission of Contributions
121
+
122
+Unless You explicitly state otherwise, any Contribution intentionally submitted
123
+for inclusion in the Work by You to the Licensor shall be under the terms and
124
+conditions of this License, without any additional terms or conditions.
125
+Notwithstanding the above, nothing herein shall supersede or modify the terms of
126
+any separate license agreement you may have executed with Licensor regarding
127
+such Contributions.
128
+
129
+#### 6. Trademarks
130
+
131
+This License does not grant permission to use the trade names, trademarks,
132
+service marks, or product names of the Licensor, except as required for
133
+reasonable and customary use in describing the origin of the Work and
134
+reproducing the content of the NOTICE file.
135
+
136
+#### 7. Disclaimer of Warranty
137
+
138
+Unless required by applicable law or agreed to in writing, Licensor provides the
139
+Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
140
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
141
+including, without limitation, any warranties or conditions of TITLE,
142
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
143
+solely responsible for determining the appropriateness of using or
144
+redistributing the Work and assume any risks associated with Your exercise of
145
+permissions under this License.
146
+
147
+#### 8. Limitation of Liability
148
+
149
+In no event and under no legal theory, whether in tort (including negligence),
150
+contract, or otherwise, unless required by applicable law (such as deliberate
151
+and grossly negligent acts) or agreed to in writing, shall any Contributor be
152
+liable to You for damages, including any direct, indirect, special, incidental,
153
+or consequential damages of any character arising as a result of this License or
154
+out of the use or inability to use the Work (including but not limited to
155
+damages for loss of goodwill, work stoppage, computer failure or malfunction, or
156
+any and all other commercial damages or losses), even if such Contributor has
157
+been advised of the possibility of such damages.
158
+
159
+#### 9. Accepting Warranty or Additional Liability
160
+
161
+While redistributing the Work or Derivative Works thereof, You may choose to
162
+offer, and charge a fee for, acceptance of support, warranty, indemnity, or
163
+other liability obligations and/or rights consistent with this License. However,
164
+in accepting such obligations, You may act only on Your own behalf and on Your
165
+sole responsibility, not on behalf of any other Contributor, and only if You
166
+agree to indemnify, defend, and hold each Contributor harmless for any liability
167
+incurred by, or claims asserted against, such Contributor by reason of your
168
+accepting any such warranty or additional liability.
169
+
170
+_END OF TERMS AND CONDITIONS_
171
+
172
+### APPENDIX: How to apply the Apache License to your work
173
+
174
+To apply the Apache License to your work, attach the following boilerplate
175
+notice, with the fields enclosed by brackets `[]` replaced with your own
176
+identifying information. (Don't include the brackets!) The text should be
177
+enclosed in the appropriate comment syntax for the file format. We also
178
+recommend that a file or class name and description of purpose be included on
179
+the same “printed page” as the copyright notice for easier identification within
180
+third-party archives.
181
+
182
+    Copyright 2019 Bob Rudis
183
+
184
+    Licensed under the Apache License, Version 2.0 (the "License");
185
+    you may not use this file except in compliance with the License.
186
+    You may obtain a copy of the License at
187
+
188
+      http://www.apache.org/licenses/LICENSE-2.0
189
+
190
+    Unless required by applicable law or agreed to in writing, software
191
+    distributed under the License is distributed on an "AS IS" BASIS,
192
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193
+    See the License for the specific language governing permissions and
194
+    limitations under the License.

+ 6
- 25
NAMESPACE View File

@@ -1,27 +1,8 @@
1 1
 # Generated by roxygen2: do not edit by hand
2 2
 
3
-export(Athena)
4
-export(athena_connect)
5
-export(db_data_type.AthenaConnection)
6
-export(read_credentials)
7
-export(sql_translate_env.AthenaConnection)
8
-export(use_credentials)
9
-exportClasses(AthenaConnection)
10
-exportClasses(AthenaDriver)
11
-exportClasses(AthenaResult)
12
-exportMethods(dbConnect)
13
-exportMethods(dbExistsTable)
14
-exportMethods(dbGetInfo)
15
-exportMethods(dbGetQuery)
16
-exportMethods(dbListFields)
17
-exportMethods(dbListTables)
18
-exportMethods(dbReadTable)
19
-exportMethods(dbSendQuery)
20
-exportMethods(fetch)
21
-import(DBI)
22
-import(RJDBC)
23
-import(bit64)
24
-import(dbplyr)
25
-importFrom(aws.signature,read_credentials)
26
-importFrom(aws.signature,use_credentials)
27
-importFrom(rJava,.jcall)
3
+export(athena_supported_types)
4
+export(metis_jar_path)
5
+export(simba_driver_version)
6
+import(rJava)
7
+importFrom(utils,compareVersion)
8
+importFrom(utils,packageVersion)

+ 2
- 17
NEWS.md View File

@@ -1,19 +1,4 @@
1
-0.3.0
1
+2.0.6
2 2
 =========
3 3
 
4
-- Added `sql_translate_env.AthenaConnection()`
5
-- Handles Athena JDBC column types!
6
-
7
-0.2.0
8
-=========
9
-
10
-- Updated authentication provider to be `com.amazonaws.athena.jdbc.shaded.com.amazonaws.auth.DefaultAWSCredentialsProviderChain` (via @dabdine)
11
-- Now supports additional DBI/RJDBC methods including: `dbExistsTable()`,
12
-  `dbListFields()`, `dbListTables()`, `dbReadTable()`
13
-- More documentation
14
-- Added code of conduct
15
-
16
-0.1.0 
17
-=========
18
-
19
-- Using the `cloudyr` `aws.signature` package vs DIY 
4
+- Refactor

+ 0
- 16
R/a-utils.R View File

@@ -1,16 +0,0 @@
1
-set_names <- function (object = nm, nm) {
2
-  names(object) <- nm
3
-  object
4
-}
5
-
6
-as_logical <- function(x) {
7
-  as.logical(as.integer(x))
8
-}
9
-
10
-as_date <- function(x) {
11
-  as.Date(x, origin = "1970-01-01")
12
-}
13
-
14
-as_posixct <- function(x) {
15
-  as.POSIXct(x, origin = "1970-01-01 00:00:00")
16
-}

+ 0
- 223
R/jdbc.r View File

@@ -1,223 +0,0 @@
1
-structure(
2
-  0:6,
3
-  .Names = c(
4
-    "OFF", "FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE"
5
-  )
6
-)-> .ll_trans
7
-
8
-#' AthenaJDBC
9
-#'
10
-#' @export
11
-setClass(
12
-
13
-  "AthenaDriver",
14
-  representation(
15
-    "JDBCDriver",
16
-    identifier.quote = "character",
17
-    jdrv = "jobjRef"
18
-  )
19
-
20
-)
21
-
22
-#' AthenaJDBC
23
-#'
24
-#' @export
25
-Athena <- function(identifier.quote = '`') {
26
-
27
-  JDBC(
28
-    driverClass = "com.simba.athena.jdbc.Driver",
29
-    system.file("java", "AthenaJDBC42_2.0.6.jar", package = "metis.lite"),
30
-    identifier.quote = identifier.quote
31
-  ) -> drv
32
-
33
-  return(as(drv, "AthenaDriver"))
34
-
35
-}
36
-
37
-#' AthenaJDBC
38
-#'
39
-#' Connect to Athena
40
-#'
41
-#' @section Driver Configuration Options:
42
-#'
43
-#' - `BinaryColumnLength`: <int> The maximum data length for `BINARY` columns. Default `32767L`
44
-#' - `ComplexTypeColumnLength`: <int> The maximum data length for `ARRAY`, `MAP`, and `STRUCT` columns. Default `65535L`
45
-#' - `StringColumnLength`: <int> The maximum data length for `STRING` columns. Default `255L`
46
-#'
47
-#' @param provider JDBC auth provider (ideally leave default)
48
-#' @param region AWS region the Athena tables are in
49
-#' @param s3_staging_dir A write-able bucket on S3 that you have permissions for
50
-#' @param schema_name LOL if only this actually worked with Amazon's hacked Presto driver
51
-#' @param max_error_retries,connection_timeout,socket_timeout
52
-#'     technical connection info that you should only muck with if you know what you're doing.
53
-#' @param log_path,log_level The Athena JDBC driver can (shockingly) provide a decent bit
54
-#'     of data in logs. Set this to a temporary directory or something log4j can use. For
55
-#'     `log_level` use the names ("INFO", "DEBUG", "WARN", "ERROR", "ALL", "OFF", "FATAL", "TRACE") or
56
-#'     their corresponding integer values 0-6.
57
-#' @param ... passed on to the driver. See Details.
58
-#' @references [Connect with JDBC](https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html);
59
-#'     [Simba Athena JDBC Driver with SQL Connector Installation and Configuration Guide](https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.6/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf)
60
-#' @export
61
-setMethod(
62
-
63
-  "dbConnect",
64
-  "AthenaDriver",
65
-
66
-  def = function(
67
-    drv,
68
-    provider = "com.simba.athena.amazonaws.auth.DefaultAWSCredentialsProviderChain",
69
-    region = "us-east-1",
70
-    s3_staging_dir = Sys.getenv("AWS_S3_STAGING_DIR"),
71
-    schema_name = "default",
72
-    fetch_size = 1000L,
73
-    max_error_retries = 10,
74
-    connection_timeout = 10000,
75
-    socket_timeout = 10000,
76
-    log_path = "",
77
-    log_level = 0,
78
-    ...) {
79
-
80
-    conn_string = sprintf(
81
-      'jdbc:awsathena://athena.%s.amazonaws.com:443/%s', region, schema_name
82
-    )
83
-
84
-    if (!(log_level %in% 0:6)) log_level <- .ll_trans[log_level]
85
-
86
-    callNextMethod(
87
-      drv,
88
-      conn_string,
89
-      S3OutputLocation = s3_staging_dir,
90
-      Schema = schema_name,
91
-      MaxErrorRetry = max_error_retries,
92
-      ConnectTimeout = connection_timeout,
93
-      SocketTimeout = socket_timeout,
94
-      LogPath = log_path,
95
-      LogLevel = log_level,
96
-      AwsCredentialsProviderClass = provider,
97
-      ...
98
-    ) -> jc
99
-
100
-
101
-    jc <- as(jc, "AthenaConnection")
102
-    jc@fetch_size <- as.integer(fetch_size)
103
-
104
-    return(jc)
105
-
106
-  }
107
-
108
-)
109
-
110
-#' AthenaJDBC
111
-#'
112
-#' @export
113
-setClass("AthenaConnection", representation("JDBCConnection", jc="jobjRef", identifier.quote="character", fetch_size="integer"))
114
-
115
-# setClass("AthenaConnection", contains = "JDBCConnection")
116
-
117
-#' AthenaJDBC
118
-#'
119
-#' @export
120
-setClass("AthenaResult", contains = "JDBCResult")
121
-
122
-#' AthenaJDBC
123
-#'
124
-#' @param conn Athena connection
125
-#' @param statement SQL statement
126
-#' @param ... unused
127
-#' @export
128
-setMethod(
129
-
130
-  "dbSendQuery",
131
-  signature(conn="AthenaConnection", statement="character"),
132
-
133
-  definition = function(conn, statement, ...) {
134
-    return(as(callNextMethod(), "AthenaResult"))
135
-  }
136
-
137
-)
138
-
139
-#' AthenaJDBC
140
-#'
141
-#' @param conn Athena connection
142
-#' @param pattern table name pattern
143
-#' @param schema Athena schema name
144
-#' @param ... unused
145
-#' @export
146
-setMethod(
147
-
148
-  "dbListTables",
149
-  signature(conn="AthenaConnection"),
150
-
151
-  definition = function(conn, pattern='*', schema, ...) {
152
-
153
-    if (missing(pattern)) {
154
-      dbGetQuery(
155
-        conn, sprintf("SHOW TABLES IN %s", schema)
156
-      ) -> x
157
-    } else {
158
-      dbGetQuery(
159
-        conn, sprintf("SHOW TABLES IN %s %s", schema, dbQuoteString(conn, pattern))
160
-      ) -> x
161
-    }
162
-
163
-    x$tab_name
164
-  }
165
-
166
-)
167
-
168
-#' AthenaJDBC
169
-#'
170
-#' @param conn Athena connection
171
-#' @param name table name
172
-#' @param schema Athena schema name
173
-#' @param ... unused
174
-#' @export
175
-setMethod(
176
-
177
-  "dbExistsTable",
178
-  signature(conn="AthenaConnection", name="character"),
179
-
180
-  definition = function(conn, name, schema, ...) {
181
-    length(dbListTables(conn, schema=schema, pattern=name)) > 0
182
-  }
183
-
184
-)
185
-
186
-#' AthenaJDBC
187
-#'
188
-#' @param conn Athena connection
189
-#' @param name table name
190
-#' @param schema Athena schema name
191
-#' @param ... unused
192
-#' @export
193
-setMethod(
194
-
195
-  "dbListFields",
196
-  signature(conn="AthenaConnection", name="character"),
197
-
198
-  definition = function(conn, name, schema, ...) {
199
-    query <- sprintf("SELECT * FROM %s.%s LIMIT 1", schema, name)
200
-    res <- dbGetQuery(conn, query)
201
-    colnames(res)
202
-  }
203
-
204
-)
205
-
206
-#' AthenaJDBC
207
-#'
208
-#' @param conn Athena connection
209
-#' @param name table name
210
-#' @param schema Athena schema name
211
-#' @param ... unused
212
-#' @export
213
-setMethod(
214
-
215
-  "dbReadTable",
216
-  signature(conn="AthenaConnection", name="character"),
217
-
218
-  definition = function(conn, name, schema, ...) {
219
-    query <- sprintf("SELECT * FROM %s.%s LIMIT 1", schema, dbQuoteString(conn, name))
220
-    dbGetQuery(conn, query)
221
-  }
222
-
223
-)

+ 32
- 0
R/metis-jars-package.R View File

@@ -0,0 +1,32 @@
1
+#' Amazon Athena JDBC Driver Wrapper Supporting the 'metis' Package
2
+#'
3
+#' Contents of the Amazon Athena JDBC Driver
4
+#' <https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html>
5
+#' provided to support functions in the 'metis' package. Version number
6
+#' reflects the version number of the included 'JAR' file.
7
+#'
8
+#' @name metis.jars
9
+#'
10
+#' @section IMPORTANT:
11
+#'
12
+#' Until a release of 'rJava' newer than '0.9.10' is on CRAN signals sent
13
+#' from interrupting Athena JDBC calls crash the R interpreter. You therefore
14
+#' need to set the `-Xrs` option to avoid signals being passed on to the JVM
15
+#' owner. That has to be done _before_ `rJava` is loaded so you either need
16
+#' to remember to put it at the top of all scripts _or_ stick this
17
+#' in your local  `~/.Rprofile` and/or sitewide `Rprofile`:
18
+#'
19
+#'     options(
20
+#'       "java.parameters" = c(getOption("java.parameters", default = NULL), "-Xrs")
21
+#'     )
22
+#'
23
+#'
24
+#' @md
25
+#' @encoding UTF-8
26
+#' @keywords internal
27
+#' @docType package
28
+#' @author Bob Rudis (bob@@rud.is)
29
+#' @import rJava
30
+#' @importFrom utils packageVersion compareVersion
31
+#' @references [Simba Athena JDBC Driver with SQL Connector Installation and Configuration Guide](https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.6/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf)
32
+NULL

+ 0
- 48
R/metis-lite-package.R View File

@@ -1,48 +0,0 @@
1
-#' Access and Query Amazon Athena via DBI/JDBC
2
-#'
3
-#' Methods are provides to connect to 'Amazon' 'Athena', lookup schemas/tables,
4
-#' perform queries and retrieve query results. A lightweight 'RJDBC' implementation
5
-#' is included along with an interface to the 'AWS' command-line utility.
6
-#'
7
-#' @name metis.lite
8
-#'
9
-#' @section IMPORTANT:
10
-#'
11
-#' Since R 3.5 (I don't remember this happening in R 3.4.x) signals sent from interrupting
12
-#' Athena JDBC calls crash the R #' interpreter. You need to set the `-Xrs` option to avoid
13
-#' signals being passed on to the JVM owner. That has to be done _before_ `rJava` is
14
-#' loaded so you either need to remember to put it at the top of all scripts _or_ stick this
15
-#' in your local #' `~/.Rprofile` and/or sitewide `Rprofile`:
16
-#'
17
-#'
18
-#'     if (!grepl("-Xrs", getOption("java.parameters", ""))) {
19
-#'       options(
20
-#'         "java.parameters" = c(getOption("java.parameters", default = NULL), "-Xrs")
21
-#'       )
22
-#'     }
23
-#'
24
-#' @md
25
-#' @encoding UTF-8
26
-#' @keywords internal
27
-#' @docType package
28
-#' @author Bob Rudis (bob@@rud.is)
29
-#' @import RJDBC DBI bit64 dbplyr
30
-#' @references [Simba Athena JDBC Driver with SQL Connector Installation and Configuration Guide](https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.6/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf)
31
-NULL
32
-
33
-
34
-#' Use Credentials from .aws/credentials File
35
-#'
36
-#' @md
37
-#' @importFrom aws.signature use_credentials read_credentials
38
-#' @references [aws.signature::use_credentials()] /  [aws.signature::read_credentials()]
39
-#' @name use_credentials
40
-#' @rdname use_credentials
41
-#' @inheritParams aws.signature::use_credentials
42
-#' @export
43
-NULL
44
-
45
-#' @name read_credentials
46
-#' @rdname use_credentials
47
-#' @export
48
-NULL

+ 0
- 68
R/metis.r View File

@@ -1,68 +0,0 @@
1
-#' Simplified Athena JDBC connection helper
2
-#'
3
-#' Handles the up-front JDBC config
4
-#'
5
-#' @md
6
-#' @param default_schema default schema (you'll still need to fully qualify non-default schema table names)
7
-#' @param region AWS region (Ref: <http://docs.aws.amazon.com/general/latest/gr/rande.html#athena>)
8
-#' @param s3_staging_dir the Amazon S3 location to which your query output is written. The JDBC driver then asks Athena to read the results and provide rows of data back to the user.
9
-#' @param max_error_retries the maximum number of retries that the JDBC client attempts to make a request to Athena.
10
-#' @param connection_timeout the maximum amount of time, in milliseconds, to make a successful connection to Athena before an attempt is terminated.
11
-#' @param socket_timeout the maximum amount of time, in milliseconds, to wait for a socket in order to send data to Athena.
12
-# @param retry_base_delay minimum delay amount, in milliseconds, between retrying attempts to connect Athena.
13
-# @param retry_max_backoff_time maximum delay amount, in milliseconds, between retrying attempts to connect Athena.
14
-#' @param log_path local path of the Athena JDBC driver logs. If no log path is provided, then no log files are created.
15
-#' @param log_level log level of the Athena JDBC driver logs. Use  names
16
-#'     "OFF", "FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE".
17
-#' @param ... passed on to the driver
18
-#' @export
19
-#' @references [Connect with JDBC](https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html);
20
-#'     [Simba Athena JDBC Driver with SQL Connector Installation and Configuration Guide](https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.6/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf)
21
-#' @examples \dontrun{
22
-#' use_credentials("personal")
23
-#'
24
-#' athena_connect(
25
-#'   default_schema = "sampledb",
26
-#'   s3_staging_dir = "s3://accessible-bucket",
27
-#'   log_path = "/tmp/athena.log",
28
-#'   log_level = "DEBUG"
29
-#' ) -> ath
30
-#'
31
-#' dbListTables(ath)
32
-#'
33
-#' dbGetQuery(ath, "SELECT * FROM sampledb.elb_logs LIMIT 1")
34
-#'
35
-#' }
36
-athena_connect <- function(
37
-  default_schema = "default",
38
-  region = c("us-east-1", "us-east-2", "us-west-2"),
39
-  s3_staging_dir = Sys.getenv("AWS_S3_STAGING_DIR"),
40
-  max_error_retries = 10,
41
-  connection_timeout = 10000,
42
-  socket_timeout = 10000,
43
-  log_path = "",
44
-  log_level = c("OFF", "FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE"),
45
-  ...
46
-) {
47
-
48
-  athena_jdbc <- Athena()
49
-
50
-  region <- match.arg(region, c("us-east-1", "us-east-2", "us-west-2"))
51
-  log_level <- match.arg(log_level, c("OFF", "FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE"))
52
-
53
-  dbConnect(
54
-    athena_jdbc,
55
-    schema_name = default_schema,
56
-    region = region,
57
-    s3_staging_dir = s3_staging_dir,
58
-    max_error_retries = max_error_retries,
59
-    connection_timeout = connection_timeout,
60
-    socket_timeout = socket_timeout,
61
-    log_path = log_path,
62
-    log_level = log_level,
63
-    ...
64
-  ) -> con
65
-
66
-  con
67
-
68
-}

+ 15
- 0
R/metis_jar_path.R View File

@@ -0,0 +1,15 @@
1
+#' Retrieve the fully-qualified path to the included Athena JAR file
2
+#'
3
+#' @export
4
+#' @examples
5
+#' metis_jar_path()
6
+metis_jar_path <- function() {
7
+
8
+  list.files(
9
+    path = system.file("java", package = "metis.jars"),
10
+    pattern = "Ath.*jar$",
11
+    full.names = TRUE
12
+  )[1]
13
+
14
+}
15
+

+ 0
- 124
R/sql_translate_env.R View File

@@ -1,124 +0,0 @@
1
-#' @rdname Athena
2
-#' @keywords internal
3
-#' @export
4
-db_data_type.AthenaConnection <- function(con, fields, ...) {
5
-  print("\n\n\ndb_data_type\n\n\n")
6
-  data_type <- function(x) {
7
-    switch(
8
-      class(x)[1],
9
-      integer64 = "BIGINT",
10
-      logical = "BOOLEAN",
11
-      integer = "INTEGER",
12
-      numeric = "DOUBLE",
13
-      factor =  "CHARACTER",
14
-      character = "CHARACTER",
15
-      Date = "DATE",
16
-      POSIXct = "TIMESTAMP",
17
-      stop("Can't map type ", paste(class(x), collapse = "/"),
18
-           " to a supported database type.")
19
-    )
20
-  }
21
-  vapply(fields, data_type, character(1))
22
-}
23
-
24
-#' @rdname Athena
25
-#' @keywords internal
26
-#' @export
27
-sql_translate_env.AthenaConnection <- function(con) {
28
-
29
-  x <- con
30
-
31
-  dbplyr::sql_variant(
32
-
33
-    scalar = dbplyr::sql_translator(
34
-      .parent = dbplyr::base_scalar,
35
-      `!=` = dbplyr::sql_infix("<>"),
36
-      as.integer64 = function(x) dbplyr::build_sql("CAST(", x, "AS BIGINT)"),
37
-      as.numeric = function(x) dbplyr::build_sql("CAST(", x, " AS DOUBLE)"),
38
-      as.character = function(x) dbplyr::build_sql("CAST(", x, " AS CHARACTER)"),
39
-      as.date = function(x) dbplyr::build_sql("CAST(", x, " AS DATE)"),
40
-      as.Date = function(x) dbplyr::build_sql("CAST(", x, " AS DATE)"),
41
-      as.POSIXct = function(x) dbplyr::build_sql("CAST(", x, " AS TIMESTAMP)"),
42
-      as.posixct = function(x) dbplyr::build_sql("CAST(", x, " AS TIMESTAMP)"),
43
-      as.logical = function(x) dbplyr::build_sql("CAST(", x, " AS BOOLEAN)"),
44
-      date_part = function(x, y) dbplyr::build_sql("DATE_PART(", x, ",", y ,")"),
45
-      grepl = function(x, y) dbplyr::build_sql("CONTAINS(", y, ", ", x, ")"),
46
-      gsub = function(x, y, z) dbplyr::build_sql("REGEXP_REPLACE(", z, ", ", x, ",", y ,")"),
47
-      trimws = function(x) dbplyr::build_sql("TRIM(both ' ' FROM ", x, ")"),
48
-      cbrt = dbplyr::sql_prefix("CBRT", 1),
49
-      degrees = dbplyr::sql_prefix("DEGREES", 1),
50
-      e = dbplyr::sql_prefix("E", 0),
51
-      row_number = dbplyr::sql_prefix("row_number", 0),
52
-      lshift = dbplyr::sql_prefix("LSHIFT", 2),
53
-      mod = dbplyr::sql_prefix("MOD", 2),
54
-      age = dbplyr::sql_prefix("AGE", 1),
55
-      negative = dbplyr::sql_prefix("NEGATIVE", 1),
56
-      pi = dbplyr::sql_prefix("PI", 0),
57
-      pow = dbplyr::sql_prefix("POW", 2),
58
-      radians = dbplyr::sql_prefix("RADIANS", 1),
59
-      rand = dbplyr::sql_prefix("RAND", 0),
60
-      rshift = dbplyr::sql_prefix("RSHIFT", 2),
61
-      trunc = dbplyr::sql_prefix("TRUNC", 2),
62
-      contains = dbplyr::sql_prefix("CONTAINS", 2),
63
-      convert_to = dbplyr::sql_prefix("CONVERT_TO", 2),
64
-      convert_from = dbplyr::sql_prefix("CONVERT_FROM", 2),
65
-      string_binary = dbplyr::sql_prefix("STRING_BINARY", 1),
66
-      binary_string = dbplyr::sql_prefix("BINARY_STRING", 1),
67
-      to_char = dbplyr::sql_prefix("TO_CHAR", 2),
68
-      to_date = dbplyr::sql_prefix("TO_DATE", 2),
69
-      to_number = dbplyr::sql_prefix("TO_NUMBER", 2),
70
-      char_to_timestamp = dbplyr::sql_prefix("TO_TIMESTAMP", 2),
71
-      double_to_timestamp = dbplyr::sql_prefix("TO_TIMESTAMP", 1),
72
-      char_length = dbplyr::sql_prefix("CHAR_LENGTH", 1),
73
-      flatten = dbplyr::sql_prefix("FLATTEN", 1),
74
-      kvgen = dbplyr::sql_prefix("KVGEN", 1),
75
-      repeated_count = dbplyr::sql_prefix("REPEATED_COUNT", 1),
76
-      repeated_contains = dbplyr::sql_prefix("REPEATED_CONTAINS", 2),
77
-      ilike = dbplyr::sql_prefix("ILIKE", 2),
78
-      init_cap = dbplyr::sql_prefix("INIT_CAP", 1),
79
-      length = dbplyr::sql_prefix("LENGTH", 1),
80
-      lower = dbplyr::sql_prefix("LOWER", 1),
81
-      tolower = dbplyr::sql_prefix("LOWER", 1),
82
-      ltrim = dbplyr::sql_prefix("LTRIM", 2),
83
-      nullif = dbplyr::sql_prefix("NULLIF", 2),
84
-      position = function(x, y) dbplyr::build_sql("POSITION(", x, " IN ", y, ")"),
85
-      regexp_replace = dbplyr::sql_prefix("REGEXP_REPLACE", 3),
86
-      rtrim = dbplyr::sql_prefix("RTRIM", 2),
87
-      rpad = dbplyr::sql_prefix("RPAD", 2),
88
-      rpad_with = dbplyr::sql_prefix("RPAD", 3),
89
-      lpad = dbplyr::sql_prefix("LPAD", 2),
90
-      lpad_with = dbplyr::sql_prefix("LPAD", 3),
91
-      strpos = dbplyr::sql_prefix("STRPOS", 2),
92
-      substr = dbplyr::sql_prefix("SUBSTR", 3),
93
-      trim = function(x, y, z) dbplyr::build_sql("TRIM(", x, " ", y, " FROM ", z, ")"),
94
-      upper = dbplyr::sql_prefix("UPPER", 1),
95
-      toupper = dbplyr::sql_prefix("UPPER", 1)
96
-    ),
97
-
98
-    aggregate = dbplyr::sql_translator(
99
-      .parent = dbplyr::base_agg,
100
-      n = function() dbplyr::sql("COUNT(*)"),
101
-      cor = dbplyr::sql_prefix("CORR"),
102
-      cov = dbplyr::sql_prefix("COVAR_SAMP"),
103
-      sd =  dbplyr::sql_prefix("STDDEV_SAMP"),
104
-      var = dbplyr::sql_prefix("VAR_SAMP"),
105
-      n_distinct = function(x) {
106
-        dbplyr::build_sql(dbplyr::sql("COUNT(DISTINCT "), x, dbplyr::sql(")"))
107
-      }
108
-    ),
109
-
110
-    window = dbplyr::sql_translator(
111
-      .parent = dbplyr::base_win,
112
-      n = function() { dbplyr::win_over(dbplyr::sql("count(*)"),
113
-                                        partition = dbplyr::win_current_group()) },
114
-      cor = dbplyr::win_recycled("corr"),
115
-      cov = dbplyr::win_recycled("covar_samp"),
116
-      sd =  dbplyr::win_recycled("stddev_samp"),
117
-      var = dbplyr::win_recycled("var_samp"),
118
-      all = dbplyr::win_recycled("bool_and"),
119
-      any = dbplyr::win_recycled("bool_or")
120
-    )
121
-
122
-  )
123
-
124
-}

+ 15
- 0
R/types.R View File

@@ -0,0 +1,15 @@
1
+#' Retrieve the current supported type names in Athena
2
+#'
3
+#' @export
4
+#' @examples
5
+#' athena_supported_types()
6
+athena_supported_types <- function() {
7
+  gsub(
8
+    "^AJ_|_TYPE_NAME$", "",
9
+    grep(
10
+      "^AJ_",
11
+      names(rJava::J("com.simba.athena.athena.AthenaTypes")),
12
+      value=TRUE
13
+    )
14
+  )
15
+}

+ 8
- 0
R/version.R View File

@@ -0,0 +1,8 @@
1
+#' Retrieve the version of the Simba Athena JDBC driver included with the package
2
+#'
3
+#' @export
4
+#' @examples
5
+#' simba_driver_version()
6
+simba_driver_version <- function() {
7
+  rJava::J("com.simba.athena.athena.core.AJDriver")$AJ_DRIVER_VERSION
8
+}

+ 0
- 121
R/z-dbGetQuery.R View File

@@ -1,121 +0,0 @@
1
-list(
2
-  "-7" = as.logical, # BIT
3
-  "-6" = as.integer, # TINYINT
4
-  "-5" = bit64::as.integer64, # BIGINT
5
-  "-4" = as.character, # LONGVARBINARY
6
-  "-3" = as.character, # VARBINARY
7
-  "-2" = as.character, # BINARY
8
-  "-1" = as.character, # LONGVARCHAR
9
-  "0" = as.character, # NULL
10
-  "1" = as.character, # CHAR
11
-  "2" = as.double, # NUMERIC
12
-  "3" = as.double, # DECIMAL
13
-  "4" = as.integer, # INTEGER
14
-  "5" = as.integer, # SMALLINT
15
-  "6" = as.double, # FLOAT
16
-  "7" = as.double, # REAL
17
-  "8" = as.double, # DOUBLE
18
-  "12" = as.character, # VARCHAR
19
-  "16" = as_logical, # BOOLEAN
20
-  "91" = as_date, # DATE
21
-  "92" = as.character, # TIME
22
-  "93" = as_posixct, # TIMESTAMP
23
-  "2003" = as.character, # ARRAY
24
-  "1111" = as.character # OTHER
25
-) -> .jdbc_converters
26
-
27
-#' @export
28
-#' @keywords internal
29
-setMethod("dbGetInfo", "AthenaDriver", def=function(dbObj, ...)
30
-  list(
31
-    name = "AthenaJDBC",
32
-    driver_version = list.files(system.file("java", package="metis.lite"), "jar$")[1],
33
-    package_version = utils::packageVersion("metis.lite")
34
-  )
35
-)
36
-
37
-#' @export
38
-#' @keywords internal
39
-setMethod("dbGetInfo", "AthenaConnection", def=function(dbObj, ...)
40
-  list(
41
-    name = "AthenaJDBC",
42
-    driver_version = list.files(system.file("java", package="metis.lite"), "jar$")[1],
43
-    package_version = utils::packageVersion("metis.lite")
44
-  )
45
-)
46
-
47
-
48
-#' Fetch records from a previously executed query
49
-#'
50
-#' Fetch the next `n` elements (rows) from the result set and return them
51
-#' as a data.frame.
52
-#'
53
-#' @param res An object inheriting from [DBIResult-class], created by
54
-#'   [dbSendQuery()].
55
-#' @param n maximum number of records to retrieve per fetch. Use `n = -1`
56
-#'   or `n = Inf`
57
-#'   to retrieve all pending records.  Some implementations may recognize other
58
-#'   special values.
59
-#' @param ... Other arguments passed on to methods.
60
-#' @export
61
-setMethod(
62
-  "fetch",
63
-  signature(res="AthenaResult", n="numeric"),
64
-  def = function(res, n, block = 1000L, ...) {
65
-
66
-    nms <- c()
67
-    athena_type_convert <- list()
68
-
69
-    cols <- .jcall(res@md, "I", "getColumnCount")
70
-
71
-    for (i in 1:cols) {
72
-      ct <- as.character(.jcall(res@md, "I", "getColumnType", i))
73
-      athena_type_convert[[i]] <- .jdbc_converters[[ct]]
74
-      nms <- c(nms, .jcall(res@md, "S", "getColumnLabel", i))
75
-      # message(ct, "|", tail(nms, 1))
76
-    }
77
-
78
-    athena_type_convert <- set_names(athena_type_convert, nms)
79
-
80
-    out <- callNextMethod(res = res, n = n, block = block, ...)
81
-
82
-    # print(str(out))
83
-
84
-    for (nm in names(athena_type_convert)) {
85
-      f <- athena_type_convert[[nm]]
86
-      if (length(f) == 0) f <- as.character # catchall in case AMZN is tricksy
87
-      out[[nm]] <- f(out[[nm]])
88
-    }
89
-
90
-    out
91
-
92
-  }
93
-)
94
-
95
-#' AthenaJDBC
96
-#'
97
-#' @param conn Athena connection
98
-#' @param statement SQL statement
99
-#' @param ... unused
100
-#' @importFrom rJava .jcall
101
-#' @export
102
-setMethod(
103
-
104
-  "dbGetQuery",
105
-  signature(conn="AthenaConnection", statement="character"),
106
-
107
-  definition = function(conn, statement, ...) {
108
-
109
-    r <- dbSendQuery(conn, statement, ...)
110
-
111
-    on.exit(.jcall(r@stat, "V", "close"))
112
-
113
-    res <- fetch(r, -1, block = conn@fetch_size)
114
-
115
-    class(res) <- c("tbl_df", "tbl", "data.frame")
116
-
117
-    res
118
-
119
-  }
120
-
121
-)

+ 20
- 7
R/zzz.R View File

@@ -1,11 +1,24 @@
1
+.onAttach <- function(libname, pkgname) {
2
+
3
+  if (interactive()) {
4
+    jv <- utils::packageVersion("rJava")
5
+    if (utils::compareVersion(toString(jv), "0.9.10") < 1) {
6
+      o <- getOption("java.parameters", "")
7
+      if (!any(grepl("\\-Xrs", o))) {
8
+        packageStartupMessage(
9
+          "Did not find '-Xrs' in java.parameters option. Until rJava is updated, ",
10
+          "please set this up in your/an Rprofile or at the start of scripts. ",
11
+          "See the 'IMPORTANT' section under ?`metis.jars-package`."
12
+        )
13
+      }
14
+    }
15
+  }
16
+
17
+}
18
+
1 19
 .onLoad <- function(libname, pkgname) {
20
+
2 21
   rJava::.jpackage(pkgname, jars = "*", lib.loc = libname)
3 22
   rJava::.jaddClassPath(dir(file.path(getwd(), "inst/java"), full.names = TRUE))
4
-  o <- getOption("java.parameters", "")
5
-  if (!any(grepl("-Xrs", o))) {
6
-    packageStartupMessage(
7
-      "Did not find '-Xrs' in java.parameters option. Until rJava is updated, ",
8
-      "please set this up in your/an Rprofile or at the start of scripts."
9
-    )
10
-  }
23
+
11 24
 }

+ 26
- 109
README.Rmd View File

@@ -4,64 +4,47 @@ editor_options:
4 4
   chunk_output_type: console
5 5
 ---
6 6
 
7
-# metis
7
+# metis.jars
8 8
 
9
-Access and Query Amazon Athena via DBI/JDBC
9
+Amazon Athena JDBC Driver Wrapper Supporting the 'metis' Package
10 10
 
11 11
 ## Description
12 12
 
13
-In Greek mythology, Metis was Athena's "helper" so methods are provided to help you accessing and querying Amazon Athena via DBI/JDBC and/or `dplyr`.
14
-#' Methods are provides to connect to 'Amazon' 'Athena', lookup schemas/tables,
13
+Contents of the Amazon Athena JDBC Driver 
14
+<https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html>
15
+provided to support functions in the 'metis' package. Version number 
16
+reflects the version number of the included 'JAR' file.
15 17
 
16 18
 ## IMPORTANT
17 19
 
18
-Since R 3.5 (I don't remember this happening in R 3.4.x) signals sent from interrupting Athena JDBC calls crash the R interpreter. You need to set the `-Xrs` option to avoid signals being passed on to the JVM owner. That has to be done _before_ `rJava` is loaded so you either need to remember to put it at the top of all scripts _or_ stick this in your local `~/.Rprofile` and/or sitewide `Rprofile`:
20
+Until a release of 'rJava' newer than '0.9.10' is on CRAN signals sent 
21
+from interrupting Athena JDBC calls crash the R interpreter. You therefore 
22
+need to set the `-Xrs` option to avoid signals being passed on to the JVM 
23
+owner. That has to be done _before_ `rJava` is loaded so you either need 
24
+to remember to put it at the top of all scripts _or_ stick this
25
+in your local  `~/.Rprofile` and/or sitewide `Rprofile`:
19 26
 
20 27
 ```r
21
-if (!grepl("-Xrs", getOption("java.parameters", ""))) {
22
-  options(
23
-    "java.parameters" = c(getOption("java.parameters", default = NULL), "-Xrs")
24
-  )
25
-}
28
+options(
29
+  "java.parameters" = c(getOption("java.parameters", default = NULL), "-Xrs")
30
+)
26 31
 ```
27 32
 ## What's Inside The Tin?
28 33
 
29 34
 The following functions are implemented:
30 35
 
31
-Easy-interface connection helper:
32
-
33
-- `athena_connect`	Simplified Athena JDBC connection helper
34
-
35
-Custom JDBC Classes:
36
-
37
-- `Athena`:	AthenaJDBC (make a new Athena con obj)
38
-- `AthenaConnection-class`:	AthenaJDBC
39
-- `AthenaDriver-class`:	AthenaJDBC
40
-- `AthenaResult-class`:	AthenaJDBC
41
-
42
-Custom JDBC Class Methods:
43
-
44
-- `dbConnect-method`
45
-- `dbExistsTable-method`
46
-- `dbGetQuery-method`
47
-- `dbListFields-method`
48
-- `dbListTables-method`
49
-- `dbReadTable-method`
50
-- `dbSendQuery-method`
51
-
52
-Pulled in from other `cloudyr` pkgs: 
53
-
54
-- `read_credentials`:	Use Credentials from .aws/credentials File
55
-- `use_credentials`:	Use Credentials from .aws/credentials File
36
+- `athena_supported_types`:	Retrieve the current supported type names in Athena
37
+- `metis_jar_path()` : Retrieve the fully-qualified path to the included Athena JAR file
38
+- `simba_driver_version`:	Retrieve the version of the Simba Athena JDBC driver included with the package
56 39
 
57 40
 ## Installation
58 41
 
59 42
 ```{r eval=FALSE}
60
-devtools::install_git("https://git.sr.ht/~hrbrmstr/metis-lite")
43
+devtools::install_git("https://git.sr.ht/~hrbrmstr/metis-jars")
61 44
 # OR
62
-devtools::install_gitlab("hrbrmstr/metis-lite")
45
+devtools::install_gitlab("hrbrmstr/metis-jars")
63 46
 # OR
64
-devtools::install_github("hrbrmstr/metis-lite")
47
+devtools::install_github("hrbrmstr/metis-jars")
65 48
 ```
66 49
 
67 50
 ```{r message=FALSE, warning=FALSE, include=FALSE}
@@ -71,84 +54,18 @@ options(width=120)
71 54
 ## Usage
72 55
 
73 56
 ```{r message=FALSE, warning=FALSE}
74
-library(metis.lite)
57
+library(metis.jars)
75 58
 
76 59
 # current verison
77
-packageVersion("metis.lite")
78
-```
79
-
80
-```{r message=FALSE, warning=FALSE}
81
-library(rJava)
82
-library(RJDBC)
83
-library(metis.lite)
84
-library(magrittr)
85
-library(dbplyr)
86
-library(dplyr)
87
-
88
-dbConnect(
89
-  drv = metis.lite::Athena(),
90
-  schema_name = "sampledb",
91
-  provider = "com.simba.athena.amazonaws.auth.PropertiesFileCredentialsProvider",
92
-  AwsCredentialsProviderArguments = path.expand("~/.aws/athenaCredentials.props"),
93
-  s3_staging_dir = "s3://aws-athena-query-results-569593279821-us-east-1",
94
-) -> con
95
-
96
-dbListTables(con, schema="sampledb")
97
-
98
-dbExistsTable(con, "elb_logs", schema="sampledb")
99
-
100
-dbListFields(con, "elb_logs", "sampledb")
101
-
102
-dbGetQuery(con, "SELECT * FROM sampledb.elb_logs LIMIT 10") %>% 
103
-  glimpse()
60
+packageVersion("metis.jars")
104 61
 ```
105 62
 
106
-### Check types
107
-
108 63
 ```{r}
109
-dbGetQuery(con, "
110
-SELECT
111
-  CAST('chr' AS CHAR(4)) achar,
112
-  CAST('varchr' AS VARCHAR) avarchr,
113
-  CAST(SUBSTR(timestamp, 1, 10) AS DATE) AS tsday,
114
-  CAST(100.1 AS DOUBLE) AS justadbl,
115
-  CAST(127 AS TINYINT) AS asmallint,
116
-  CAST(100 AS INTEGER) AS justanint,
117
-  CAST(100000000000000000 AS BIGINT) AS abigint,
118
-  CAST(('GET' = 'GET') AS BOOLEAN) AS is_get,
119
-  ARRAY[1, 2, 3] AS arr1,
120
-  ARRAY['1', '2, 3', '4'] AS arr2,
121
-  MAP(ARRAY['foo', 'bar'], ARRAY[1, 2]) AS mp,
122
-  CAST(ROW(1, 2.0) AS ROW(x BIGINT, y DOUBLE)) AS rw,
123
-  CAST('{\"a\":1}' AS JSON) js
124
-FROM elb_logs
125
-LIMIT 1
126
-") %>% 
127
-  glimpse()
128
-```
64
+simba_driver_version()
129 65
 
130
-#### dplyr
66
+athena_supported_types()
131 67
 
132
-```{r}
133
-tbl(con, sql("
134
-SELECT
135
-  CAST('chr' AS CHAR(4)) achar,
136
-  CAST('varchr' AS VARCHAR) avarchr,
137
-  CAST(SUBSTR(timestamp, 1, 10) AS DATE) AS tsday,
138
-  CAST(100.1 AS DOUBLE) AS justadbl,
139
-  CAST(127 AS TINYINT) AS asmallint,
140
-  CAST(100 AS INTEGER) AS justanint,
141
-  CAST(100000000000000000 AS BIGINT) AS abigint,
142
-  CAST(('GET' = 'GET') AS BOOLEAN) AS is_get,
143
-  ARRAY[1, 2, 3] AS arr,
144
-  ARRAY['1', '2, 3', '4'] AS arr,
145
-  MAP(ARRAY['foo', 'bar'], ARRAY[1, 2]) AS mp,
146
-  CAST(ROW(1, 2.0) AS ROW(x BIGINT, y DOUBLE)) AS rw,
147
-  CAST('{\"a\":1}' AS JSON) js
148
-FROM elb_logs
149
-LIMIT 1
150
-")) %>% 
151
-  glimpse()
68
+metis_jar_path()
152 69
 ```
153 70
 
154 71
 ## Code of Conduct

+ 35
- 177
README.md View File

@@ -1,223 +1,81 @@
1 1
 
2
-# metis
2
+# metis.jars
3 3
 
4
-Access and Query Amazon Athena via DBI/JDBC
4
+Amazon Athena JDBC Driver Wrapper Supporting the ‘metis’ Package
5 5
 
6 6
 ## Description
7 7
 
8
-In Greek mythology, Metis was Athena’s “helper” so methods are provided
9
-to help you accessing and querying Amazon Athena via DBI/JDBC and/or
10
-`dplyr`. \#’ Methods are provides to connect to ‘Amazon’ ‘Athena’,
11
-lookup schemas/tables,
8
+Contents of the Amazon Athena JDBC Driver
9
+<https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html>
10
+provided to support functions in the ‘metis’ package. Version number
11
+reflects the version number of the included ‘JAR’ file.
12 12
 
13 13
 ## IMPORTANT
14 14
 
15
-Since R 3.5 (I don’t remember this happening in R 3.4.x) signals sent
16
-from interrupting Athena JDBC calls crash the R interpreter. You need to
17
-set the `-Xrs` option to avoid signals being passed on to the JVM owner.
18
-That has to be done *before* `rJava` is loaded so you either need to
19
-remember to put it at the top of all scripts *or* stick this in your
20
-local `~/.Rprofile` and/or sitewide `Rprofile`:
15
+Until a release of ‘rJava’ newer than ‘0.9.10’ is on CRAN signals sent
16
+from interrupting Athena JDBC calls crash the R interpreter. You
17
+therefore need to set the `-Xrs` option to avoid signals being passed on
18
+to the JVM owner. That has to be done *before* `rJava` is loaded so you
19
+either need to remember to put it at the top of all scripts *or* stick
20
+this in your local `~/.Rprofile` and/or sitewide `Rprofile`:
21 21
 
22 22
 ``` r
23
-if (!grepl("-Xrs", getOption("java.parameters", ""))) {
24
-  options(
25
-    "java.parameters" = c(getOption("java.parameters", default = NULL), "-Xrs")
26
-  )
27
-}
23
+options(
24
+  "java.parameters" = c(getOption("java.parameters", default = NULL), "-Xrs")
25
+)
28 26
 ```
29 27
 
30 28
 ## What’s Inside The Tin?
31 29
 
32 30
 The following functions are implemented:
33 31
 
34
-Easy-interface connection helper:
35
-
36
-  - `athena_connect` Simplified Athena JDBC connection helper
37
-
38
-Custom JDBC Classes:
39
-
40
-  - `Athena`: AthenaJDBC (make a new Athena con obj)
41
-  - `AthenaConnection-class`: AthenaJDBC
42
-  - `AthenaDriver-class`: AthenaJDBC
43
-  - `AthenaResult-class`: AthenaJDBC
44
-
45
-Custom JDBC Class Methods:
46
-
47
-  - `dbConnect-method`
48
-  - `dbExistsTable-method`
49
-  - `dbGetQuery-method`
50
-  - `dbListFields-method`
51
-  - `dbListTables-method`
52
-  - `dbReadTable-method`
53
-  - `dbSendQuery-method`
54
-
55
-Pulled in from other `cloudyr` pkgs:
56
-
57
-  - `read_credentials`: Use Credentials from .aws/credentials File
58
-  - `use_credentials`: Use Credentials from .aws/credentials File
32
+  - `athena_supported_types`: Retrieve the current supported type names
33
+    in Athena
34
+  - `metis_jar_path()` : Retrieve the fully-qualified path to the
35
+    included Athena JAR file
36
+  - `simba_driver_version`: Retrieve the version of the Simba Athena
37
+    JDBC driver included with the package
59 38
 
60 39
 ## Installation
61 40
 
62 41
 ``` r
63
-devtools::install_git("https://git.sr.ht/~hrbrmstr/metis-lite")
42
+devtools::install_git("https://git.sr.ht/~hrbrmstr/metis-jars")
64 43
 # OR
65
-devtools::install_gitlab("hrbrmstr/metis-lite")
44
+devtools::install_gitlab("hrbrmstr/metis-jars")
66 45
 # OR
67
-devtools::install_github("hrbrmstr/metis-lite")
46
+devtools::install_github("hrbrmstr/metis-jars")
68 47
 ```
69 48
 
70 49
 ## Usage
71 50
 
72 51
 ``` r
73
-library(metis.lite)
52
+library(metis.jars)
74 53
 
75 54
 # current verison
76
-packageVersion("metis.lite")
77
-```
78
-
79
-    ## [1] '0.3.0'
80
-
81
-``` r
82
-library(rJava)
83
-library(RJDBC)
84
-library(metis.lite)
85
-library(magrittr)
86
-library(dbplyr)
87
-library(dplyr)
88
-
89
-dbConnect(
90
-  drv = metis.lite::Athena(),
91
-  schema_name = "sampledb",
92
-  provider = "com.simba.athena.amazonaws.auth.PropertiesFileCredentialsProvider",
93
-  AwsCredentialsProviderArguments = path.expand("~/.aws/athenaCredentials.props"),
94
-  s3_staging_dir = "s3://aws-athena-query-results-569593279821-us-east-1",
95
-) -> con
96
-
97
-dbListTables(con, schema="sampledb")
98
-```
99
-
100
-    ## [1] "elb_logs"
101
-
102
-``` r
103
-dbExistsTable(con, "elb_logs", schema="sampledb")
104
-```
105
-
106
-    ## [1] TRUE
107
-
108
-``` r
109
-dbListFields(con, "elb_logs", "sampledb")
55
+packageVersion("metis.jars")
110 56
 ```
111 57
 
112
-    ##  [1] "timestamp"             "elbname"               "requestip"             "requestport"          
113
-    ##  [5] "backendip"             "backendport"           "requestprocessingtime" "backendprocessingtime"
114
-    ##  [9] "clientresponsetime"    "elbresponsecode"       "backendresponsecode"   "receivedbytes"        
115
-    ## [13] "sentbytes"             "requestverb"           "url"                   "protocol"
58
+    ## [1] '2.0.6'
116 59
 
117 60
 ``` r
118
-dbGetQuery(con, "SELECT * FROM sampledb.elb_logs LIMIT 10") %>% 
119
-  glimpse()
61
+simba_driver_version()
120 62
 ```
121 63
 
122
-    ## Observations: 10
123
-    ## Variables: 16
124
-    ## $ timestamp             <chr> "2014-09-29T18:18:51.826955Z", "2014-09-29T18:18:51.920462Z", "2014-09-29T18:18:52.2725…
125
-    ## $ elbname               <chr> "lb-demo", "lb-demo", "lb-demo", "lb-demo", "lb-demo", "lb-demo", "lb-demo", "lb-demo",…
126
-    ## $ requestip             <chr> "255.48.150.122", "249.213.227.93", "245.108.120.229", "241.112.203.216", "241.43.107.2…
127
-    ## $ requestport           <int> 62096, 62096, 62096, 62096, 56454, 33254, 18918, 64352, 1651, 56454
128
-    ## $ backendip             <chr> "244.238.214.120", "248.99.214.228", "243.3.190.175", "246.235.181.255", "241.112.203.2…
129
-    ## $ backendport           <int> 8888, 8888, 8888, 8888, 8888, 8888, 8888, 8888, 8888, 8888
130
-    ## $ requestprocessingtime <dbl> 9.0e-05, 9.7e-05, 8.7e-05, 9.4e-05, 7.6e-05, 8.3e-05, 6.3e-05, 5.4e-05, 8.2e-05, 8.7e-05
131
-    ## $ backendprocessingtime <dbl> 0.007410, 0.256533, 0.442659, 0.016772, 0.035036, 0.029892, 0.034148, 0.014858, 0.01518…
132
-    ## $ clientresponsetime    <dbl> 0.000055, 0.000075, 0.000131, 0.000078, 0.000057, 0.000043, 0.000033, 0.000043, 0.00007…
133
-    ## $ elbresponsecode       <chr> "302", "302", "200", "200", "200", "200", "200", "200", "200", "200"
134
-    ## $ backendresponsecode   <chr> "200", "200", "200", "200", "200", "200", "200", "200", "200", "200"
135
-    ## $ receivedbytes         <S3: integer64> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
136
-    ## $ sentbytes             <S3: integer64> 0, 0, 58402, 152213, 20766, 32370, 3408, 3884, 84245, 3831
137
-    ## $ requestverb           <chr> "GET", "GET", "GET", "GET", "GET", "GET", "GET", "GET", "GET", "GET"
138
-    ## $ url                   <chr> "http://www.abcxyz.com:80/", "http://www.abcxyz.com:80/accounts/login/?next=/", "http:/…
139
-    ## $ protocol              <chr> "HTTP/1.1", "HTTP/1.1", "HTTP/1.1", "HTTP/1.1", "HTTP/1.1", "HTTP/1.1", "HTTP/1.1", "HT…
140
-
141
-### Check types
64
+    ## [1] "02.00.06.1008"
142 65
 
143 66
 ``` r
144
-dbGetQuery(con, "
145
-SELECT
146
-  CAST('chr' AS CHAR(4)) achar,
147
-  CAST('varchr' AS VARCHAR) avarchr,
148
-  CAST(SUBSTR(timestamp, 1, 10) AS DATE) AS tsday,
149
-  CAST(100.1 AS DOUBLE) AS justadbl,
150
-  CAST(127 AS TINYINT) AS asmallint,
151
-  CAST(100 AS INTEGER) AS justanint,
152
-  CAST(100000000000000000 AS BIGINT) AS abigint,
153
-  CAST(('GET' = 'GET') AS BOOLEAN) AS is_get,
154
-  ARRAY[1, 2, 3] AS arr1,
155
-  ARRAY['1', '2, 3', '4'] AS arr2,
156
-  MAP(ARRAY['foo', 'bar'], ARRAY[1, 2]) AS mp,
157
-  CAST(ROW(1, 2.0) AS ROW(x BIGINT, y DOUBLE)) AS rw,
158
-  CAST('{\"a\":1}' AS JSON) js
159
-FROM elb_logs
160
-LIMIT 1
161
-") %>% 
162
-  glimpse()
67
+athena_supported_types()
163 68
 ```
164 69
 
165
-    ## Observations: 1
166
-    ## Variables: 13
167
-    ## $ achar     <chr> "chr "
168
-    ## $ avarchr   <chr> "varchr"
169
-    ## $ tsday     <date> 2014-09-26
170
-    ## $ justadbl  <dbl> 100.1
171
-    ## $ asmallint <int> 127
172
-    ## $ justanint <int> 100
173
-    ## $ abigint   <S3: integer64> 100000000000000000
174
-    ## $ is_get    <lgl> TRUE
175
-    ## $ arr1      <chr> "1, 2, 3"
176
-    ## $ arr2      <chr> "1, 2, 3, 4"
177
-    ## $ mp        <chr> "{bar=2, foo=1}"
178
-    ## $ rw        <chr> "{x=1, y=2.0}"
179
-    ## $ js        <chr> "\"{\\\"a\\\":1}\""
180
-
181
-#### dplyr
70
+    ##  [1] "BOOLEAN"   "TINYINT"   "SMALLINT"  "INT"       "INTEGER"   "BIGINT"    "REAL"      "FLOAT"     "DOUBLE"   
71
+    ## [10] "DECIMAL"   "DATE"      "TIMESTAMP" "BINARY"    "VARBINARY" "CHAR"      "VARCHAR"   "STRING"    "ARRAY"    
72
+    ## [19] "MAP"       "ROW"       "STRUCT"
182 73
 
183 74
 ``` r
184
-tbl(con, sql("
185
-SELECT
186
-  CAST('chr' AS CHAR(4)) achar,
187
-  CAST('varchr' AS VARCHAR) avarchr,
188
-  CAST(SUBSTR(timestamp, 1, 10) AS DATE) AS tsday,
189
-  CAST(100.1 AS DOUBLE) AS justadbl,
190
-  CAST(127 AS TINYINT) AS asmallint,
191
-  CAST(100 AS INTEGER) AS justanint,
192
-  CAST(100000000000000000 AS BIGINT) AS abigint,
193
-  CAST(('GET' = 'GET') AS BOOLEAN) AS is_get,
194
-  ARRAY[1, 2, 3] AS arr,
195
-  ARRAY['1', '2, 3', '4'] AS arr,
196
-  MAP(ARRAY['foo', 'bar'], ARRAY[1, 2]) AS mp,
197
-  CAST(ROW(1, 2.0) AS ROW(x BIGINT, y DOUBLE)) AS rw,
198
-  CAST('{\"a\":1}' AS JSON) js
199
-FROM elb_logs
200
-LIMIT 1
201
-")) %>% 
202
-  glimpse()
75
+metis_jar_path()
203 76
 ```
204 77
 
205
-    ## Observations: ??
206
-    ## Variables: 13
207
-    ## Database: AthenaConnection
208
-    ## $ achar     <chr> "chr "
209
-    ## $ avarchr   <chr> "varchr"
210
-    ## $ tsday     <date> 2014-09-27
211
-    ## $ justadbl  <dbl> 100.1
212
-    ## $ asmallint <int> 127
213
-    ## $ justanint <int> 100
214
-    ## $ abigint   <S3: integer64> 100000000000000000
215
-    ## $ is_get    <lgl> TRUE
216
-    ## $ arr       <chr> "1, 2, 3"
217
-    ## $ arr       <chr> "1, 2, 3, 4"
218
-    ## $ mp        <chr> "{bar=2, foo=1}"
219
-    ## $ rw        <chr> "{x=1, y=2.0}"
220
-    ## $ js        <chr> "\"{\\\"a\\\":1}\""
78
+    ## [1] "/Library/Frameworks/R.framework/Versions/3.5/Resources/library/metis.jars/java/AthenaJDBC42_2.0.6.jar"
221 79
 
222 80
 ## Code of Conduct
223 81
 

+ 69
- 0
inst/COPYRIGHTS View File

@@ -0,0 +1,69 @@
1
+The metis.jars package is released under the Apache 2.0 License
2
+
3
+The include AthenaJDBC42_2.0.6.jar JAR has the following license:
4
+-----------------
5
+License for AWS SDK for Java
6
+
7
+Apache License
8
+Version 2.0, January 2004
9
+
10
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+1. Definitions.
13
+
14
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
15
+
16
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
17
+
18
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
19
+
20
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
21
+
22
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
23
+
24
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
25
+
26
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
27
+
28
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
29
+
30
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
31
+
32
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
33
+
34
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
35
+
36
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
37
+
38
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
39
+
40
+   1.   You must give any other recipients of the Work or Derivative Works a copy of this License; and
41
+   2.   You must cause any modified files to carry prominent notices stating that You changed the files; and
42
+   3.   You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
43
+   4.   If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
44
+
45
+You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
46
+
47
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
48
+
49
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
50
+
51
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
52
+
53
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
54
+
55
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
56
+
57
+END OF TERMS AND CONDITIONS
58
+
59
+Note: Other license terms may apply to certain, identified software files contained within or distributed with the accompanying software if such terms are included in the directory containing the accompanying software. Such other license terms will then apply in lieu of the terms of the software license above.
60
+
61
+JSON processing code subject to the JSON License from JSON.org:
62
+
63
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
64
+
65
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
66
+
67
+The Software shall be used for Good, not Evil.
68
+
69
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 0
- 18
man/Athena.Rd View File

@@ -1,18 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r, R/sql_translate_env.R
3
-\name{Athena}
4
-\alias{Athena}
5
-\alias{db_data_type.AthenaConnection}
6
-\alias{sql_translate_env.AthenaConnection}
7
-\title{AthenaJDBC}
8
-\usage{
9
-Athena(identifier.quote = "`")
10
-
11
-db_data_type.AthenaConnection(con, fields, ...)
12
-
13
-sql_translate_env.AthenaConnection(con)
14
-}
15
-\description{
16
-AthenaJDBC
17
-}
18
-\keyword{internal}

+ 0
- 9
man/AthenaConnection-class.Rd View File

@@ -1,9 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r
3
-\docType{class}
4
-\name{AthenaConnection-class}
5
-\alias{AthenaConnection-class}
6
-\title{AthenaJDBC}
7
-\description{
8
-AthenaJDBC
9
-}

+ 0
- 9
man/AthenaDriver-class.Rd View File

@@ -1,9 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r
3
-\docType{class}
4
-\name{AthenaDriver-class}
5
-\alias{AthenaDriver-class}
6
-\title{AthenaJDBC}
7
-\description{
8
-AthenaJDBC
9
-}

+ 0
- 9
man/AthenaResult-class.Rd View File

@@ -1,9 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r
3
-\docType{class}
4
-\name{AthenaResult-class}
5
-\alias{AthenaResult-class}
6
-\title{AthenaJDBC}
7
-\description{
8
-AthenaJDBC
9
-}

+ 0
- 57
man/athena_connect.Rd View File

@@ -1,57 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/metis.r
3
-\name{athena_connect}
4
-\alias{athena_connect}
5
-\title{Simplified Athena JDBC connection helper}
6
-\usage{
7
-athena_connect(default_schema = "default", region = c("us-east-1",
8
-  "us-east-2", "us-west-2"),
9
-  s3_staging_dir = Sys.getenv("AWS_S3_STAGING_DIR"),
10
-  max_error_retries = 10, connection_timeout = 10000,
11
-  socket_timeout = 10000, log_path = "", log_level = c("OFF",
12
-  "FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE"), ...)
13
-}
14
-\arguments{
15
-\item{default_schema}{default schema (you'll still need to fully qualify non-default schema table names)}
16
-
17
-\item{region}{AWS region (Ref: \url{http://docs.aws.amazon.com/general/latest/gr/rande.html#athena})}
18
-
19
-\item{s3_staging_dir}{the Amazon S3 location to which your query output is written. The JDBC driver then asks Athena to read the results and provide rows of data back to the user.}
20
-
21
-\item{max_error_retries}{the maximum number of retries that the JDBC client attempts to make a request to Athena.}
22
-
23
-\item{connection_timeout}{the maximum amount of time, in milliseconds, to make a successful connection to Athena before an attempt is terminated.}
24
-
25
-\item{socket_timeout}{the maximum amount of time, in milliseconds, to wait for a socket in order to send data to Athena.}
26
-
27
-\item{log_path}{local path of the Athena JDBC driver logs. If no log path is provided, then no log files are created.}
28
-
29
-\item{log_level}{log level of the Athena JDBC driver logs. Use  names
30
-"OFF", "FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE".}
31
-
32
-\item{...}{passed on to the driver}
33
-}
34
-\description{
35
-Handles the up-front JDBC config
36
-}
37
-\examples{
38
-\dontrun{
39
-use_credentials("personal")
40
-
41
-athena_connect(
42
-  default_schema = "sampledb",
43
-  s3_staging_dir = "s3://accessible-bucket",
44
-  log_path = "/tmp/athena.log",
45
-  log_level = "DEBUG"
46
-) -> ath
47
-
48
-dbListTables(ath)
49
-
50
-dbGetQuery(ath, "SELECT * FROM sampledb.elb_logs LIMIT 1")
51
-
52
-}
53
-}
54
-\references{
55
-\href{https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html}{Connect with JDBC};
56
-\href{https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.6/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf}{Simba Athena JDBC Driver with SQL Connector Installation and Configuration Guide}
57
-}

+ 14
- 0
man/athena_supported_types.Rd View File

@@ -0,0 +1,14 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/types.R
3
+\name{athena_supported_types}
4
+\alias{athena_supported_types}
5
+\title{Retrieve the current supported type names in Athena}
6
+\usage{
7
+athena_supported_types()
8
+}
9
+\description{
10
+Retrieve the current supported type names in Athena
11
+}
12
+\examples{
13
+athena_supported_types()
14
+}

+ 0
- 48
man/dbConnect-AthenaDriver-method.Rd View File

@@ -1,48 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r
3
-\docType{methods}
4
-\name{dbConnect,AthenaDriver-method}
5
-\alias{dbConnect,AthenaDriver-method}
6
-\title{AthenaJDBC}
7
-\usage{
8
-\S4method{dbConnect}{AthenaDriver}(drv,
9
-  provider = "com.simba.athena.amazonaws.auth.DefaultAWSCredentialsProviderChain",
10
-  region = "us-east-1",
11
-  s3_staging_dir = Sys.getenv("AWS_S3_STAGING_DIR"),
12
-  schema_name = "default", fetch_size = 1000L,
13
-  max_error_retries = 10, connection_timeout = 10000,
14
-  socket_timeout = 10000, log_path = "", log_level = 0, ...)
15
-}
16
-\arguments{
17
-\item{provider}{JDBC auth provider (ideally leave default)}
18
-
19
-\item{region}{AWS region the Athena tables are in}
20
-
21
-\item{s3_staging_dir}{A write-able bucket on S3 that you have permissions for}
22
-
23
-\item{schema_name}{LOL if only this actually worked with Amazon's hacked Presto driver}
24
-
25
-\item{max_error_retries, connection_timeout, socket_timeout}{technical connection info that you should only muck with if you know what you're doing.}
26
-
27
-\item{log_path, log_level}{The Athena JDBC driver can (shockingly) provide a decent bit
28
-of data in logs. Set this to a temporary directory or something log4j can use. For
29
-`log_level` use the names ("INFO", "DEBUG", "WARN", "ERROR", "ALL", "OFF", "FATAL", "TRACE") or
30
-their corresponding integer values 0-6.}
31
-
32
-\item{...}{passed on to the driver. See Details.}
33
-}
34
-\description{
35
-Connect to Athena
36
-}
37
-\section{Driver Configuration Options}{
38
-
39
-
40
-- `BinaryColumnLength`: <int> The maximum data length for `BINARY` columns. Default `32767L`
41
-- `ComplexTypeColumnLength`: <int> The maximum data length for `ARRAY`, `MAP`, and `STRUCT` columns. Default `65535L`
42
-- `StringColumnLength`: <int> The maximum data length for `STRING` columns. Default `255L`
43
-}
44
-
45
-\references{
46
-[Connect with JDBC](https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html);
47
-    [Simba Athena JDBC Driver with SQL Connector Installation and Configuration Guide](https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.6/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf)
48
-}

+ 0
- 22
man/dbExistsTable-AthenaConnection-character-method.Rd View File

@@ -1,22 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r
3
-\docType{methods}
4
-\name{dbExistsTable,AthenaConnection,character-method}
5
-\alias{dbExistsTable,AthenaConnection,character-method}
6
-\title{AthenaJDBC}
7
-\usage{
8
-\S4method{dbExistsTable}{AthenaConnection,character}(conn, name, schema,
9
-  ...)
10
-}
11
-\arguments{
12
-\item{conn}{Athena connection}
13
-
14
-\item{name}{table name}
15
-
16
-\item{schema}{Athena schema name}
17
-
18
-\item{...}{unused}
19
-}
20
-\description{
21
-AthenaJDBC
22
-}

+ 0
- 19
man/dbGetQuery-AthenaConnection-character-method.Rd View File

@@ -1,19 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/z-dbGetQuery.R
3
-\docType{methods}
4
-\name{dbGetQuery,AthenaConnection,character-method}
5
-\alias{dbGetQuery,AthenaConnection,character-method}
6
-\title{AthenaJDBC}
7
-\usage{
8
-\S4method{dbGetQuery}{AthenaConnection,character}(conn, statement, ...)
9
-}
10
-\arguments{
11
-\item{conn}{Athena connection}
12
-
13
-\item{statement}{SQL statement}
14
-
15
-\item{...}{unused}
16
-}
17
-\description{
18
-AthenaJDBC
19
-}

+ 0
- 22
man/dbListFields-AthenaConnection-character-method.Rd View File

@@ -1,22 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r
3
-\docType{methods}
4
-\name{dbListFields,AthenaConnection,character-method}
5
-\alias{dbListFields,AthenaConnection,character-method}
6
-\title{AthenaJDBC}
7
-\usage{
8
-\S4method{dbListFields}{AthenaConnection,character}(conn, name, schema,
9
-  ...)
10
-}
11
-\arguments{
12
-\item{conn}{Athena connection}
13
-
14
-\item{name}{table name}
15
-
16
-\item{schema}{Athena schema name}
17
-
18
-\item{...}{unused}
19
-}
20
-\description{
21
-AthenaJDBC
22
-}

+ 0
- 22
man/dbListTables-AthenaConnection-method.Rd View File

@@ -1,22 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r
3
-\docType{methods}
4
-\name{dbListTables,AthenaConnection-method}
5
-\alias{dbListTables,AthenaConnection-method}
6
-\title{AthenaJDBC}
7
-\usage{
8
-\S4method{dbListTables}{AthenaConnection}(conn, pattern = "*", schema,
9
-  ...)
10
-}
11
-\arguments{
12
-\item{conn}{Athena connection}
13
-
14
-\item{pattern}{table name pattern}
15
-
16
-\item{schema}{Athena schema name}
17
-
18
-\item{...}{unused}
19
-}
20
-\description{
21
-AthenaJDBC
22
-}

+ 0
- 21
man/dbReadTable-AthenaConnection-character-method.Rd View File

@@ -1,21 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r
3
-\docType{methods}
4
-\name{dbReadTable,AthenaConnection,character-method}
5
-\alias{dbReadTable,AthenaConnection,character-method}
6
-\title{AthenaJDBC}
7
-\usage{
8
-\S4method{dbReadTable}{AthenaConnection,character}(conn, name, schema, ...)
9
-}
10
-\arguments{
11
-\item{conn}{Athena connection}
12
-
13
-\item{name}{table name}
14
-
15
-\item{schema}{Athena schema name}
16
-
17
-\item{...}{unused}
18
-}
19
-\description{
20
-AthenaJDBC
21
-}

+ 0
- 19
man/dbSendQuery-AthenaConnection-character-method.Rd View File

@@ -1,19 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/jdbc.r
3
-\docType{methods}
4
-\name{dbSendQuery,AthenaConnection,character-method}
5
-\alias{dbSendQuery,AthenaConnection,character-method}
6
-\title{AthenaJDBC}
7
-\usage{
8
-\S4method{dbSendQuery}{AthenaConnection,character}(conn, statement, ...)
9
-}
10
-\arguments{
11
-\item{conn}{Athena connection}
12
-
13
-\item{statement}{SQL statement}
14
-
15
-\item{...}{unused}
16
-}
17
-\description{
18
-AthenaJDBC
19
-}

+ 0
- 24
man/fetch-AthenaResult-numeric-method.Rd View File

@@ -1,24 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/z-dbGetQuery.R
3
-\docType{methods}
4
-\name{fetch,AthenaResult,numeric-method}
5
-\alias{fetch,AthenaResult,numeric-method}
6
-\title{Fetch records from a previously executed query}
7
-\usage{
8
-\S4method{fetch}{AthenaResult,numeric}(res, n, block = 1000L, ...)
9
-}
10
-\arguments{
11
-\item{res}{An object inheriting from [DBIResult-class], created by
12
-[dbSendQuery()].}
13
-
14
-\item{n}{maximum number of records to retrieve per fetch. Use `n = -1`
15
-or `n = Inf`
16
-to retrieve all pending records.  Some implementations may recognize other
17
-special values.}
18
-
19
-\item{...}{Other arguments passed on to methods.}
20
-}
21
-\description{
22
-Fetch the next `n` elements (rows) from the result set and return them
23
-as a data.frame.
24
-}

+ 35
- 0
man/metis.jars.Rd View File

@@ -0,0 +1,35 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/metis-jars-package.R
3
+\docType{package}
4
+\encoding{UTF-8}
5
+\name{metis.jars}
6
+\alias{metis.jars}
7
+\alias{metis.jars-package}
8
+\title{Amazon Athena JDBC Driver Wrapper Supporting the 'metis' Package}
9
+\description{
10
+Contents of the Amazon Athena JDBC Driver
11
+\url{https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html}
12
+provided to support functions in the 'metis' package. Version number
13
+reflects the version number of the included 'JAR' file.
14
+}
15
+\section{IMPORTANT}{
16
+
17
+
18
+Until a release of 'rJava' newer than '0.9.10' is on CRAN signals sent
19
+from interrupting Athena JDBC calls crash the R interpreter. You therefore
20
+need to set the \code{-Xrs} option to avoid signals being passed on to the JVM
21
+owner. That has to be done \emph{before} \code{rJava} is loaded so you either need
22
+to remember to put it at the top of all scripts \emph{or} stick this
23
+in your local  \code{~/.Rprofile} and/or sitewide \code{Rprofile}:\preformatted{options(
24
+  "java.parameters" = c(getOption("java.parameters", default = NULL), "-Xrs")
25
+)
26
+}
27
+}
28
+
29
+\references{
30
+\href{https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.6/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf}{Simba Athena JDBC Driver with SQL Connector Installation and Configuration Guide}
31
+}
32
+\author{
33
+Bob Rudis (bob@rud.is)
34
+}
35
+\keyword{internal}

+ 0
- 35
man/metis.lite.Rd View File

@@ -1,35 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/metis-lite-package.R
3
-\docType{package}
4
-\encoding{UTF-8}
5
-\name{metis.lite}
6
-\alias{metis.lite}
7
-\alias{metis.lite-package}
8
-\title{Access and Query Amazon Athena via DBI/JDBC}
9
-\description{
10
-Methods are provides to connect to 'Amazon' 'Athena', lookup schemas/tables,
11
-perform queries and retrieve query results. A lightweight 'RJDBC' implementation
12
-is included along with an interface to the 'AWS' command-line utility.
13
-}
14
-\section{IMPORTANT}{
15
-
16
-
17
-Since R 3.5 (I don't remember this happening in R 3.4.x) signals sent from interrupting
18
-Athena JDBC calls crash the R #' interpreter. You need to set the \code{-Xrs} option to avoid
19
-signals being passed on to the JVM owner. That has to be done \emph{before} \code{rJava} is
20
-loaded so you either need to remember to put it at the top of all scripts \emph{or} stick this
21
-in your local #' \code{~/.Rprofile} and/or sitewide \code{Rprofile}:\preformatted{if (!grepl("-Xrs", getOption("java.parameters", ""))) {
22
-  options(
23
-    "java.parameters" = c(getOption("java.parameters", default = NULL), "-Xrs")
24
-  )
25
-}
26
-}
27
-}
28
-
29
-\references{
30
-\href{https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.6/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf}{Simba Athena JDBC Driver with SQL Connector Installation and Configuration Guide}
31
-}
32
-\author{
33
-Bob Rudis (bob@rud.is)
34
-}
35
-\keyword{internal}

+ 14
- 0
man/metis_jar_path.Rd View File

@@ -0,0 +1,14 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/metis_jar_path.R
3
+\name{metis_jar_path}
4
+\alias{metis_jar_path}
5
+\title{Retrieve the fully-qualified path to the included Athena JAR file}
6
+\usage{
7
+metis_jar_path()
8
+}
9
+\description{
10
+Retrieve the fully-qualified path to the included Athena JAR file
11
+}
12
+\examples{
13
+metis_jar_path()
14
+}

+ 14
- 0
man/simba_driver_version.Rd View File

@@ -0,0 +1,14 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/version.R
3
+\name{simba_driver_version}
4
+\alias{simba_driver_version}
5
+\title{Retrieve the version of the Simba Athena JDBC driver included with the package}
6
+\usage{
7
+simba_driver_version()
8
+}
9
+\description{
10
+Retrieve the version of the Simba Athena JDBC driver included with the package
11
+}
12
+\examples{
13
+simba_driver_version()
14
+}

+ 0
- 12
man/use_credentials.Rd View File

@@ -1,12 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/metis-lite-package.R
3
-\name{use_credentials}
4
-\alias{use_credentials}
5
-\alias{read_credentials}
6
-\title{Use Credentials from .aws/credentials File}
7
-\description{
8
-Use Credentials from .aws/credentials File
9
-}
10
-\references{
11
-\code{\link[aws.signature:use_credentials]{aws.signature::use_credentials()}} /  \code{\link[aws.signature:read_credentials]{aws.signature::read_credentials()}}
12
-}

metis-lite.Rproj → metis-jars.Rproj View File


+ 7
- 1
tests/test-all.R View File

@@ -1,2 +1,8 @@
1
+options(
2
+  "java.parameters" = unique(
3
+    c(getOption("java.parameters", default = NULL), "-Xrs")
4
+  )
5
+)
6
+
1 7
 library(testthat)
2
-test_check("metis-lite")
8
+test_check("metis.jars")

+ 0
- 6
tests/testthat/test-metis-lite.R View File

@@ -1,6 +0,0 @@
1
-context("basic functionality")
2
-test_that("we can do something", {
3
-
4
-  #expect_that(some_function(), is_a("data.frame"))
5
-
6
-})

+ 11
- 0
tests/testthat/test-metis.jars.R View File

@@ -0,0 +1,11 @@
1
+options(
2
+  "java.parameters" = unique(
3
+    c(getOption("java.parameters", default = NULL), "-Xrs")
4
+  )
5
+)
6
+
7
+context("JAR loads; classes available")
8
+
9
+expect_is(simba_driver_version(), "character")
10
+expect_is(athena_supported_types(), "character")
11
+expect_is(metis_jar_path(), "character")

Loading…
Cancel
Save