athens 0.3.2 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +13 -11
- data/README.md +18 -6
- data/athens.gemspec +3 -2
- data/lib/athens/configuration.rb +9 -3
- data/lib/athens/connection.rb +3 -4
- data/lib/athens/query.rb +3 -3
- data/lib/athens/version.rb +1 -1
- metadata +23 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dce70371a1505fb7f63bfbcd872ba136b998b146b005e084ae7d4f3bf5394c7b
|
4
|
+
data.tar.gz: 69e24000860943707e5b52f24dbb2289e76e0dd35c970ca9f50a59aab07289cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7b59f65553704094baf50bb4d609bacb2ec698f788ff89f27a679e9663418aa3c08282dbcd9a5a65c42a9b15065a74a2b35af111900b0965af103ef5538e29c
|
7
|
+
data.tar.gz: 62c44387712ce5bdc94da5f4091b676d7ef6e4a330ddd90732bc92f6e64cfb61a8078f93e3aaf930be04fc1e952a0c827cb4177c3c6226c37eedcbfee21b7aca
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
## 0.3.6 / 2021-11-16
|
2
|
+
|
3
|
+
* Addition of :result_encryption as a configuration option to change encryption options for query results (https://github.com/getletterpress/athens/issues/12)
|
4
|
+
* Bumped development gem versions to latest releases
|
5
|
+
|
6
|
+
## 0.3.5 / 2021-05-19
|
7
|
+
|
8
|
+
* Addition of :aws_profile as a configuration option for credentials (thanks [oisin](https://github.com/oisin))
|
9
|
+
* Fix for BigDecimal in Ruby 3.x (thanks [mediafinger](https://github.com/mediafinger))
|
10
|
+
* Bumped development gem versions to latest releases
|
11
|
+
|
12
|
+
## 0.3.4 / 2021-03-02
|
13
|
+
|
14
|
+
* Added configurable polling period (thanks [jesseproudman](https://github.com/jesseproudman))
|
15
|
+
|
16
|
+
## 0.3.3 / 2021-01-12
|
17
|
+
|
18
|
+
* Added support for Ruby 3.0 (thanks [blackjiro](https://github.com/blackjiro))
|
19
|
+
|
1
20
|
## 0.3.2 / 2020-11-24
|
2
21
|
|
3
22
|
* Added optional `request_token` and `work_group` parameters to the query execute method (thanks [mediafinger](https://github.com/mediafinger))
|
data/Gemfile.lock
CHANGED
@@ -1,34 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
athens (0.3.
|
4
|
+
athens (0.3.6)
|
5
5
|
aws-sdk-athena (~> 1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
aws-eventstream (1.
|
11
|
-
aws-partitions (1.
|
12
|
-
aws-sdk-athena (1.
|
13
|
-
aws-sdk-core (~> 3, >= 3.
|
10
|
+
aws-eventstream (1.2.0)
|
11
|
+
aws-partitions (1.530.0)
|
12
|
+
aws-sdk-athena (1.43.0)
|
13
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
14
14
|
aws-sigv4 (~> 1.1)
|
15
|
-
aws-sdk-core (3.
|
15
|
+
aws-sdk-core (3.122.1)
|
16
16
|
aws-eventstream (~> 1, >= 1.0.2)
|
17
|
-
aws-partitions (~> 1, >= 1.
|
17
|
+
aws-partitions (~> 1, >= 1.525.0)
|
18
18
|
aws-sigv4 (~> 1.1)
|
19
19
|
jmespath (~> 1.0)
|
20
|
-
aws-sigv4 (1.
|
20
|
+
aws-sigv4 (1.4.0)
|
21
21
|
aws-eventstream (~> 1, >= 1.0.2)
|
22
22
|
jmespath (1.4.0)
|
23
|
-
rake (13.0.
|
23
|
+
rake (13.0.6)
|
24
|
+
rexml (3.2.5)
|
24
25
|
|
25
26
|
PLATFORMS
|
26
27
|
ruby
|
27
28
|
|
28
29
|
DEPENDENCIES
|
29
30
|
athens!
|
30
|
-
bundler (
|
31
|
+
bundler (>= 1.17)
|
31
32
|
rake (~> 13.0)
|
33
|
+
rexml (~> 3.2)
|
32
34
|
|
33
35
|
BUNDLED WITH
|
34
|
-
2.
|
36
|
+
2.2.5
|
data/README.md
CHANGED
@@ -44,8 +44,8 @@ When your query is done, grab the results as an array:
|
|
44
44
|
```ruby
|
45
45
|
results = query.to_a
|
46
46
|
# [
|
47
|
-
# ['column_1', 'column_2', 'column_3'],
|
48
|
-
# [15, 'data', true],
|
47
|
+
# ['column_1', 'column_2', 'column_3'],
|
48
|
+
# [15, 'data', true],
|
49
49
|
# [20, 'foo', false],
|
50
50
|
# ...
|
51
51
|
# ]
|
@@ -55,7 +55,7 @@ Or as a hash (which is really an array where each row is a hash):
|
|
55
55
|
```ruby
|
56
56
|
results = query.to_h
|
57
57
|
# [
|
58
|
-
# {'column_1': 15, 'column_2': 'data', 'column_3': true},
|
58
|
+
# {'column_1': 15, 'column_2': 'data', 'column_3': true},
|
59
59
|
# {'column_1': 20, 'column_2': 'foo', 'column_3': false},
|
60
60
|
# ...
|
61
61
|
# ]
|
@@ -87,9 +87,12 @@ Configure your AWS settings in an `Athens.configure` block (in rails put this in
|
|
87
87
|
```ruby
|
88
88
|
Athens.configure do |config|
|
89
89
|
config.output_location = "s3://my-bucket/my-folder/athena/results/" # Required
|
90
|
-
config.aws_access_key
|
91
|
-
config.aws_secret_key
|
92
|
-
config.
|
90
|
+
config.aws_access_key = 'access' # Optional
|
91
|
+
config.aws_secret_key = 'secret' # Optional
|
92
|
+
config.aws_profile = 'myprofile' # Optional
|
93
|
+
config.aws_region = 'us-east-1' # Optional
|
94
|
+
config.wait_polling_period = 0.25 # Optional - What period should we poll for the complete query?
|
95
|
+
config.result_encryption = nil # Optional, see below
|
93
96
|
end
|
94
97
|
```
|
95
98
|
|
@@ -103,6 +106,14 @@ conn = Athens::Connection.new(aws_client_override: {})
|
|
103
106
|
|
104
107
|
Take a look at the [AWS Athena SDK](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Athena/Client.html#initialize-instance_method) for a list of all the available options.
|
105
108
|
|
109
|
+
The `result_encryption` option controls how the Athens results will be encrypted at the `output_location`. By default it's set to use the Amazon SSE encryption if you don't set it at all:
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
{ encryption_option: "SSE_S3" }
|
113
|
+
```
|
114
|
+
|
115
|
+
If you set it to `nil`, it'll default to the bucket encryption settings. You can also use a customer kms key, see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Athena/Types/EncryptionConfiguration.html for the correct format.
|
116
|
+
|
106
117
|
### Advanced Usage
|
107
118
|
|
108
119
|
Providing a database name to the connection is optional, if you omit the name you'll have to specify it in your query:
|
@@ -172,3 +183,4 @@ The gem is available as open source under the terms of the [WTFPL License](http:
|
|
172
183
|
## Code of Conduct
|
173
184
|
|
174
185
|
Everyone interacting in the Athens project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/getletterpress/athens/blob/master/CODE_OF_CONDUCT.md).
|
186
|
+
|
data/athens.gemspec
CHANGED
@@ -32,10 +32,11 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
|
-
spec.required_ruby_version = '
|
35
|
+
spec.required_ruby_version = '>= 2.4'
|
36
36
|
|
37
37
|
spec.add_dependency "aws-sdk-athena", "~> 1"
|
38
38
|
|
39
|
-
spec.add_development_dependency "bundler", "
|
39
|
+
spec.add_development_dependency "bundler", ">= 1.17"
|
40
40
|
spec.add_development_dependency "rake", "~> 13.0"
|
41
|
+
spec.add_development_dependency "rexml", "~> 3.2"
|
41
42
|
end
|
data/lib/athens/configuration.rb
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
module Athens
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :aws_access_key,
|
3
|
+
attr_accessor :aws_access_key,
|
4
4
|
:aws_secret_key,
|
5
5
|
:aws_region,
|
6
|
-
:output_location
|
6
|
+
:output_location,
|
7
|
+
:wait_polling_period,
|
8
|
+
:aws_profile,
|
9
|
+
:result_encryption
|
7
10
|
|
8
11
|
def initialize
|
9
12
|
@aws_access_key = nil
|
10
13
|
@aws_secret_key = nil
|
11
14
|
@aws_region = nil
|
12
15
|
@output_location = nil
|
16
|
+
@wait_polling_period = 0.25
|
17
|
+
@aws_profile = nil
|
18
|
+
@result_encryption = { encryption_option: "SSE_S3" }
|
13
19
|
end
|
14
20
|
end
|
15
|
-
end
|
21
|
+
end
|
data/lib/athens/connection.rb
CHANGED
@@ -11,7 +11,8 @@ module Athens
|
|
11
11
|
client_config = {
|
12
12
|
access_key_id: Athens.configuration.aws_access_key,
|
13
13
|
secret_access_key: Athens.configuration.aws_secret_key,
|
14
|
-
region: Athens.configuration.aws_region
|
14
|
+
region: Athens.configuration.aws_region,
|
15
|
+
profile: Athens.configuration.aws_profile
|
15
16
|
}.merge(aws_client_override).compact
|
16
17
|
|
17
18
|
@client = Aws::Athena::Client.new(client_config)
|
@@ -47,9 +48,7 @@ module Athens
|
|
47
48
|
def result_config
|
48
49
|
Aws::Athena::Types::ResultConfiguration.new(
|
49
50
|
output_location: Athens.configuration.output_location,
|
50
|
-
encryption_configuration:
|
51
|
-
encryption_option: "SSE_S3"
|
52
|
-
}
|
51
|
+
encryption_configuration: Athens.configuration.result_encryption
|
53
52
|
)
|
54
53
|
end
|
55
54
|
|
data/lib/athens/query.rb
CHANGED
@@ -14,6 +14,7 @@ module Athens
|
|
14
14
|
|
15
15
|
version = RUBY_VERSION.split('.').map {|v| v.to_i}
|
16
16
|
@decimal_without_new = (version[0] >= 2 && version[1] >= 5)
|
17
|
+
@decimal_without_new = (version[0] == 2 && version[1] >= 5) || (version[0] >= 3)
|
17
18
|
end
|
18
19
|
|
19
20
|
def state
|
@@ -49,7 +50,7 @@ module Athens
|
|
49
50
|
end
|
50
51
|
|
51
52
|
# Wait a bit and check again
|
52
|
-
sleep(
|
53
|
+
sleep(Athens.configuration.wait_polling_period.to_f)
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
@@ -173,9 +174,8 @@ module Athens
|
|
173
174
|
end
|
174
175
|
|
175
176
|
return mapped
|
176
|
-
end
|
177
|
+
end
|
177
178
|
|
178
179
|
|
179
180
|
end
|
180
181
|
end
|
181
|
-
|
data/lib/athens/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: athens
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schulte
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-athena
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.17'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.17'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '13.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rexml
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.2'
|
55
69
|
description: Allows you to easily access AWS Athena databases and run queries
|
56
70
|
email:
|
57
71
|
- chris@oceanbreezesoftware.com
|
@@ -84,13 +98,13 @@ metadata:
|
|
84
98
|
homepage_uri: https://github.com/getletterpress/athens
|
85
99
|
source_code_uri: https://github.com/getletterpress/athens
|
86
100
|
changelog_uri: https://github.com/getletterpress/athens/CHANGELOG.md
|
87
|
-
post_install_message:
|
101
|
+
post_install_message:
|
88
102
|
rdoc_options: []
|
89
103
|
require_paths:
|
90
104
|
- lib
|
91
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
92
106
|
requirements:
|
93
|
-
- - "
|
107
|
+
- - ">="
|
94
108
|
- !ruby/object:Gem::Version
|
95
109
|
version: '2.4'
|
96
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -99,8 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
113
|
- !ruby/object:Gem::Version
|
100
114
|
version: '0'
|
101
115
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
-
signing_key:
|
116
|
+
rubygems_version: 3.0.9
|
117
|
+
signing_key:
|
104
118
|
specification_version: 4
|
105
119
|
summary: Run simple SQL queries in AWS Athena
|
106
120
|
test_files: []
|