rb_snowflake_client 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '089c46288d7dc44f8717542fce8732ce32c65db796e5ac5d49fa6fff6cb1f29d'
4
- data.tar.gz: '035589f8bcc072830f037c333379a2059eb6a205ad8ae6daecb2bb2ea9c4761a'
3
+ metadata.gz: 7e69454c7c4d16eb6f69c9ccaa67d45cbd525b61a9ade0f246fb8599c99cde89
4
+ data.tar.gz: a00b73447d1557a170f089a3e2662b8eedfa008763cb9487c4db1803581aad2c
5
5
  SHA512:
6
- metadata.gz: e390973b02ce165e3bb5722c84cc79cb8c1fcc8457b57ceaf9317f2675fdfe2e5b6276d7c8a496ec5605ab66c15fcdfa2247182d1f54bed39df3c8ce4240fed7
7
- data.tar.gz: '092ba2997da8f64f6e9e7ff912d7bdb43882681f5d564028f9a9c6ad51854515e237de27b51de35329acb3fd021de3d4212551cbc31a58942592627805f2e298'
6
+ metadata.gz: d3aa6b159b79936bf28c85de07f2f13b189fc7de37c0746d151c43592a82a59d123e2023c2c776ad0d48823bf88bf96b24c3ee2d094b0c1ce64c0bd5c68ddf87
7
+ data.tar.gz: facc10e91b7bbd71df02a1f7f6158de87871f7d6e12e38e8d5e5cda8f3fce41c9487d85bb892bc7a97a63119dfe4b5595db2f3b198d73c215bcdfcf978c705a7
@@ -28,10 +28,13 @@ jobs:
28
28
  - name: Install gem
29
29
  run: cd pkg && gem install --local *.gem
30
30
  - name: Run tests
31
- run: ruby -rrb_snowflake_client spec/test.rb
31
+ run: bundle exec rspec
32
32
  env: # Or as an environment variable
33
+ SNOWFLAKE_URI: ${{ secrets.SNOWFLAKE_URI }}
34
+ SNOWFLAKE_ORGANIZATION: ${{ secrets.SNOWFLAKE_ORGANIZATION }}
33
35
  SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
36
+ SNOWFLAKE_DEFAULT_WAREHOUSE: $${{ secrets.SNOWFLAKE_DEFAULT_WAREHOUSE }}
37
+ SNOWFLAKE_DEFAULT_DATABASE: ${{ secrets.SNOWFLAKE_DEFAULT_DATABASE }}
34
38
  SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
35
39
  SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
36
- SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }}
37
40
  SNOWFLAKE_PRIVATE_KEY: ${{ secrets.SNOWFLAKE_CLIENT_TEST_PRIVATE_KEY }}
@@ -3,6 +3,8 @@ on:
3
3
  push:
4
4
  branches:
5
5
  - "master"
6
+ paths:
7
+ - "lib/ruby_snowflake/version.rb"
6
8
  jobs:
7
9
  release:
8
10
  runs-on: ubuntu-latest
@@ -3,6 +3,8 @@ on:
3
3
  push:
4
4
  branches:
5
5
  - "master"
6
+ paths:
7
+ - "lib/ruby_snowflake/version.rb"
6
8
  jobs:
7
9
  release:
8
10
  runs-on: ubuntu-latest
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rb_snowflake_client (1.1.1)
4
+ rb_snowflake_client (1.1.2)
5
5
  concurrent-ruby (>= 1.2)
6
6
  connection_pool (>= 2.4)
7
7
  dotenv (>= 2.8)
@@ -15,16 +15,16 @@ GEM
15
15
  base64 (0.2.0)
16
16
  bigdecimal (3.1.8)
17
17
  coderay (1.1.3)
18
- concurrent-ruby (1.3.1)
18
+ concurrent-ruby (1.3.3)
19
19
  connection_pool (2.4.1)
20
20
  diff-lcs (1.5.1)
21
21
  dotenv (3.1.2)
22
- jwt (2.8.1)
22
+ jwt (2.8.2)
23
23
  base64
24
24
  method_source (1.1.0)
25
- oj (3.16.3)
25
+ oj (3.16.4)
26
26
  bigdecimal (>= 3.0)
27
- parallel (1.24.0)
27
+ parallel (1.25.1)
28
28
  pry (0.14.2)
29
29
  coderay (~> 1.1)
30
30
  method_source (~> 1.0)
@@ -36,7 +36,7 @@ GEM
36
36
  rspec-mocks (~> 3.13.0)
37
37
  rspec-core (3.13.0)
38
38
  rspec-support (~> 3.13.0)
39
- rspec-expectations (3.13.0)
39
+ rspec-expectations (3.13.1)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
41
  rspec-support (~> 3.13.0)
42
42
  rspec-mocks (3.13.1)
@@ -57,4 +57,4 @@ DEPENDENCIES
57
57
  rspec
58
58
 
59
59
  BUNDLED WITH
60
- 2.5.4
60
+ 2.5.10
data/README.md CHANGED
@@ -6,7 +6,7 @@ The available options for connecting from Ruby to Snowflake include:
6
6
  * ODBC - which works, but can be very slow, especially for a lot of data, which is probably why you're using Snowflake
7
7
  * The [ruby snowflake client](https://github.com/rinsed-org/ruby-snowflake-client) that wraps the go client. This is probably the fastest single threaded option, which we also created. However, that library takes the ruby GVL and so stops all other processing in your ruby process (threads).
8
8
 
9
- This library is implemented in ruby and while it leverages some libraries that have native extensions, doesn't currently include anything itself. Depending on network latency and the shape of the data this library can be faster or slower than the go wrapper. The big advantages are:
9
+ This library is implemented in ruby and while it leverages some libraries that have native extensions, doesn't currently include any native extensions itself. Depending on network latency and the shape of the data this library can be faster or slower than the go wrapper. The big advantages are:
10
10
  * It uses about half the memory when you pull a full result set into memory
11
11
  * It does not hold onto the [ruby GVL](https://www.speedshop.co/2020/05/11/the-ruby-gvl-and-scaling.html) and so does not block other threads while waiting on IO like the go wrapper client.
12
12
  * It will consume more resources for the same data, because it's using the HTTP v2 API and getting JSON back, there is just more work to as compared to the go or python clients that use Apache Arrow under the covers.
@@ -33,6 +33,7 @@ module RubySnowflake
33
33
  class BadResponseError < Error ; end
34
34
  class ConnectionError < Error ; end
35
35
  class ConnectionStarvedError < Error ; end
36
+ class MissingConfig < Error ; end
36
37
  class RetryableBadResponseError < Error ; end
37
38
  class RequestError < Error ; end
38
39
  class QueryTimeoutError < Error ; end
@@ -73,14 +74,21 @@ module RubySnowflake
73
74
  thread_scale_factor: env_option("SNOWFLAKE_THREAD_SCALE_FACTOR", DEFAULT_THREAD_SCALE_FACTOR),
74
75
  http_retries: env_option("SNOWFLAKE_HTTP_RETRIES", DEFAULT_HTTP_RETRIES),
75
76
  query_timeout: env_option("SNOWFLAKE_QUERY_TIMEOUT", DEFAULT_QUERY_TIMEOUT))
76
- private_key = ENV["SNOWFLAKE_PRIVATE_KEY"] || File.read(ENV["SNOWFLAKE_PRIVATE_KEY_PATH"])
77
+ private_key =
78
+ if key = ENV["SNOWFLAKE_PRIVATE_KEY"]
79
+ key
80
+ elsif path = ENV["SNOWFLAKE_PRIVATE_KEY_PATH"]
81
+ File.read(path)
82
+ else
83
+ raise MissingConfig.new({}), "Either ENV['SNOWFLAKE_PRIVATE_KEY'] or ENV['SNOWFLAKE_PRIVATE_KEY_PATH'] must be set"
84
+ end
77
85
 
78
86
  new(
79
- ENV["SNOWFLAKE_URI"],
87
+ ENV.fetch("SNOWFLAKE_URI"),
80
88
  private_key,
81
- ENV["SNOWFLAKE_ORGANIZATION"],
82
- ENV["SNOWFLAKE_ACCOUNT"],
83
- ENV["SNOWFLAKE_USER"],
89
+ ENV.fetch("SNOWFLAKE_ORGANIZATION"),
90
+ ENV.fetch("SNOWFLAKE_ACCOUNT"),
91
+ ENV.fetch("SNOWFLAKE_USER"),
84
92
  ENV["SNOWFLAKE_DEFAULT_WAREHOUSE"],
85
93
  ENV["SNOWFLAKE_DEFAULT_DATABASE"],
86
94
  logger: logger,
@@ -223,7 +231,7 @@ module RubySnowflake
223
231
  def retryable_http_response_code?(code)
224
232
  # retry (in order): bad request, forbidden (token expired in flight), method not allowed,
225
233
  # request timeout, too many requests, anything in the 500 range (504 is fairly common)
226
- [400, 403, 405, 408, 429, 502, 504].include?(code.to_i) || (500..599).include?(code.to_i)
234
+ [400, 403, 405, 408, 429].include?(code.to_i) || (500..599).include?(code.to_i)
227
235
  end
228
236
 
229
237
  def retryable_log_method
@@ -1,3 +1,3 @@
1
1
  module RubySnowflake
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb_snowflake_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rinsed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-12 00:00:00.000000000 Z
11
+ date: 2024-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby