rb_snowflake_client 1.1.5 → 1.3.0
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/Gemfile.lock +14 -14
- data/README.md +2 -1
- data/lib/ruby_snowflake/client/key_pair_jwt_auth_manager.rb +2 -2
- data/lib/ruby_snowflake/client.rb +6 -6
- data/lib/ruby_snowflake/version.rb +1 -1
- data/rb_snowflake_client.gemspec +2 -1
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef7c1798270965128711042d7d218668b318356bf6a3fac8efc2144538c5a246
|
4
|
+
data.tar.gz: a04c605cfff4659c18deb58ccdca3d49db8a6d85d98825a496ab6d8641030193
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3633bc26af9b0912735ad82840795ab81c6178c381b11ae7ade7b6fd2272576a7a9d4f65a7cd22a5786ede9f2d153bc7ccb3a5816fe0263e48cb6f5df448297b
|
7
|
+
data.tar.gz: 449e2d7140b58c6d629fd17bf4641b3d698a03d10a1fb6df3444fd3bd5bf6fd6da1f146c59d96dcedd3932ddc1f5b4b086524f427385510435e36dc8de052824
|
data/Gemfile.lock
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rb_snowflake_client (1.
|
4
|
+
rb_snowflake_client (1.3.0)
|
5
|
+
bigdecimal (>= 3.0)
|
5
6
|
concurrent-ruby (>= 1.2)
|
6
7
|
connection_pool (>= 2.4)
|
7
8
|
dotenv (>= 2.8)
|
9
|
+
json (>= 2.1.0)
|
8
10
|
jwt (>= 2.7)
|
9
|
-
oj (>= 3.16)
|
10
11
|
retryable (>= 3.0)
|
11
12
|
|
12
13
|
GEM
|
13
14
|
remote: https://rubygems.org/
|
14
15
|
specs:
|
15
16
|
base64 (0.2.0)
|
16
|
-
bigdecimal (3.1.
|
17
|
+
bigdecimal (3.1.9)
|
17
18
|
coderay (1.1.3)
|
18
|
-
concurrent-ruby (1.3.
|
19
|
+
concurrent-ruby (1.3.4)
|
19
20
|
connection_pool (2.4.1)
|
20
21
|
diff-lcs (1.5.1)
|
21
|
-
dotenv (3.1.
|
22
|
-
|
22
|
+
dotenv (3.1.7)
|
23
|
+
json (2.9.1)
|
24
|
+
jwt (2.10.1)
|
23
25
|
base64
|
24
26
|
method_source (1.1.0)
|
25
|
-
|
26
|
-
|
27
|
-
parallel (1.25.1)
|
28
|
-
pry (0.14.2)
|
27
|
+
parallel (1.26.3)
|
28
|
+
pry (0.15.2)
|
29
29
|
coderay (~> 1.1)
|
30
30
|
method_source (~> 1.0)
|
31
31
|
rake (13.2.1)
|
@@ -34,15 +34,15 @@ GEM
|
|
34
34
|
rspec-core (~> 3.13.0)
|
35
35
|
rspec-expectations (~> 3.13.0)
|
36
36
|
rspec-mocks (~> 3.13.0)
|
37
|
-
rspec-core (3.13.
|
37
|
+
rspec-core (3.13.2)
|
38
38
|
rspec-support (~> 3.13.0)
|
39
|
-
rspec-expectations (3.13.
|
39
|
+
rspec-expectations (3.13.3)
|
40
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
41
|
rspec-support (~> 3.13.0)
|
42
|
-
rspec-mocks (3.13.
|
42
|
+
rspec-mocks (3.13.2)
|
43
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
44
|
rspec-support (~> 3.13.0)
|
45
|
-
rspec-support (3.13.
|
45
|
+
rspec-support (3.13.2)
|
46
46
|
|
47
47
|
PLATFORMS
|
48
48
|
arm64-darwin-22
|
data/README.md
CHANGED
@@ -197,7 +197,8 @@ ALTER USER EXAMPLE_USER SET RSA_PUBLIC_KEY = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMI
|
|
197
197
|
```
|
198
198
|
5. Verify your auth setup. If you have `snowsql` installed, that has an easy method (CTRL-d to exit)
|
199
199
|
```bash
|
200
|
-
snowsql -a
|
200
|
+
# example: snowsql -a AAAAAAA.BBBBBBBB.us-east-1 -u john --private-key-path private_key.pem
|
201
|
+
snowsql -a <account_identifier>.<region> -u <user> --private-key-path private_key.pem
|
201
202
|
```
|
202
203
|
or alternatively, use the client to verify:
|
203
204
|
```ruby
|
@@ -30,8 +30,8 @@ module RubySnowflake
|
|
30
30
|
private_key = OpenSSL::PKey.read(@private_key_pem)
|
31
31
|
|
32
32
|
payload = {
|
33
|
-
:iss => "#{@organization.upcase}-#{@account.upcase}.#{@user}.#{public_key_fingerprint}",
|
34
|
-
:sub => "#{@organization.upcase}-#{@account.upcase}.#{@user}",
|
33
|
+
:iss => "#{@organization.upcase}-#{@account.upcase}.#{@user.upcase}.#{public_key_fingerprint}",
|
34
|
+
:sub => "#{@organization.upcase}-#{@account.upcase}.#{@user.upcase}",
|
35
35
|
:iat => now,
|
36
36
|
:exp => @token_expires_at
|
37
37
|
}
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
require "base64"
|
4
4
|
require "benchmark"
|
5
|
+
require "bigdecimal"
|
5
6
|
require "concurrent"
|
6
7
|
require "connection_pool"
|
7
8
|
require "json"
|
8
9
|
require "logger"
|
9
10
|
require "net/http"
|
10
|
-
require "oj"
|
11
11
|
require "retryable"
|
12
12
|
require "securerandom"
|
13
13
|
require "uri"
|
@@ -68,7 +68,7 @@ module RubySnowflake
|
|
68
68
|
# how long to wait to allow a query to complete, in seconds
|
69
69
|
DEFAULT_QUERY_TIMEOUT = 600 # 10 minutes
|
70
70
|
|
71
|
-
|
71
|
+
JSON_PARSE_OPTIONS = { decimal_class: BigDecimal }.freeze
|
72
72
|
VALID_RESPONSE_CODES = %w(200 202).freeze
|
73
73
|
POLLING_RESPONSE_CODE = "202"
|
74
74
|
POLLING_INTERVAL = 2 # seconds
|
@@ -166,7 +166,7 @@ module RubySnowflake
|
|
166
166
|
connection,
|
167
167
|
Net::HTTP::Post,
|
168
168
|
"/api/v2/statements?requestId=#{SecureRandom.uuid}&async=#{@_enable_polling_queries}",
|
169
|
-
|
169
|
+
request_body.to_json
|
170
170
|
)
|
171
171
|
end
|
172
172
|
retrieve_result_set(query_start_time, query, response, streaming)
|
@@ -290,12 +290,12 @@ module RubySnowflake
|
|
290
290
|
end
|
291
291
|
|
292
292
|
def retrieve_result_set(query_start_time, query, response, streaming)
|
293
|
-
json_body =
|
293
|
+
json_body = JSON.parse(response.body, JSON_PARSE_OPTIONS)
|
294
294
|
statement_handle = json_body["statementHandle"]
|
295
295
|
|
296
296
|
if response.code == POLLING_RESPONSE_CODE
|
297
297
|
result_response = poll_for_completion_or_timeout(query_start_time, query, statement_handle)
|
298
|
-
json_body =
|
298
|
+
json_body = JSON.parse(result_response.body, JSON_PARSE_OPTIONS)
|
299
299
|
end
|
300
300
|
|
301
301
|
num_threads = number_of_threads_to_use(json_body["resultSetMetaData"]["partitionInfo"].size)
|
@@ -321,7 +321,7 @@ module RubySnowflake
|
|
321
321
|
end
|
322
322
|
|
323
323
|
partition_json = {}
|
324
|
-
bm = Benchmark.measure { partition_json =
|
324
|
+
bm = Benchmark.measure { partition_json = JSON.parse(partition_response.body, JSON_PARSE_OPTIONS) }
|
325
325
|
logger.debug { "JSON parsing took: #{bm.real}" }
|
326
326
|
partition_data = partition_json["data"]
|
327
327
|
|
data/rb_snowflake_client.gemspec
CHANGED
@@ -19,10 +19,11 @@ Gem::Specification.new do |s|
|
|
19
19
|
end
|
20
20
|
|
21
21
|
s.require_paths = ["lib"]
|
22
|
+
s.add_dependency "bigdecimal", ">= 3.0"
|
22
23
|
s.add_dependency "concurrent-ruby", ">= 1.2"
|
23
24
|
s.add_dependency "connection_pool", ">= 2.4"
|
24
25
|
s.add_dependency "dotenv", ">= 2.8"
|
26
|
+
s.add_dependency "json", ">= 2.1.0"
|
25
27
|
s.add_dependency "jwt", ">= 2.7"
|
26
|
-
s.add_dependency "oj", ">= 3.16"
|
27
28
|
s.add_dependency "retryable", ">= 3.0"
|
28
29
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb_snowflake_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rinsed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bigdecimal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: concurrent-ruby
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,33 +67,33 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '2.8'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: json
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 2.1.0
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 2.1.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: jwt
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '2.7'
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '2.7'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: retryable
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|