rb_snowflake_client 1.1.3 → 1.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc9cf812a682100ea6d9ac3a84156aa202342fa66e335e2c972ef50adc4234b8
4
- data.tar.gz: 549c76f63232f130dcc0f810335023612e7c198d51b6cae2911e3582027157b5
3
+ metadata.gz: d3fe7c88a471538362f7f852e9e0f0e1cc65413cecc9f308b21781325d4f8e99
4
+ data.tar.gz: 251bdb1fdb3b86919e2aac8714899fd69711813196d1109a6eb8d22e49f150ac
5
5
  SHA512:
6
- metadata.gz: 70a7c21d0ddcc12c64281363177c7f31e1f9b88a089fb04ae36700d2140828c0bfee4d0acb557ce823a867875b34d89d426e63ad4e6ad9d3a7646111d030f3e1
7
- data.tar.gz: a4652f0539d923f71bffcffab0bcf212742cc8d174756d41b231869c8def8330449f5eba6dbae9aa99293208efbde57e894c76e34bbac9404b27b152492137ec
6
+ metadata.gz: dd65b3d146f72a8109f4f7654658e911accc108451dbc15f42dd083e01e7db3499231029fd9e911fcfa76f2bc938f0329fed07ee9fad10523d56f1fb894137e0
7
+ data.tar.gz: 4368e68ca241e0563e6c2d2e408315dc0ef7648b66340d7ac137d4504f90f358ddb3d6145adbe1cdda0ed03c75ebd64a5d1d51e589be79c991654fa0608b38da
@@ -33,7 +33,7 @@ jobs:
33
33
  SNOWFLAKE_URI: ${{ secrets.SNOWFLAKE_URI }}
34
34
  SNOWFLAKE_ORGANIZATION: ${{ secrets.SNOWFLAKE_ORGANIZATION }}
35
35
  SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
36
- SNOWFLAKE_DEFAULT_WAREHOUSE: $${{ secrets.SNOWFLAKE_DEFAULT_WAREHOUSE }}
36
+ SNOWFLAKE_DEFAULT_WAREHOUSE: ${{ secrets.SNOWFLAKE_DEFAULT_WAREHOUSE }}
37
37
  SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
38
38
  SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
39
39
  SNOWFLAKE_PRIVATE_KEY: ${{ secrets.SNOWFLAKE_CLIENT_TEST_PRIVATE_KEY }}
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rb_snowflake_client (1.1.3)
4
+ rb_snowflake_client (1.1.5)
5
5
  concurrent-ruby (>= 1.2)
6
6
  connection_pool (>= 2.4)
7
7
  dotenv (>= 2.8)
@@ -9,31 +9,31 @@ module RubySnowflake
9
9
  result[0] = statement_json_body["data"]
10
10
 
11
11
  thread_pool = Concurrent::FixedThreadPool.new(num_threads)
12
- futures = []
13
- partitions.each_with_index do |partition, index|
14
- next if index == 0 # already have the first partition
15
- futures << Concurrent::Future.execute(executor: thread_pool) do
16
- [index, retreive_proc.call(index)]
12
+ partitions
13
+ .each_with_index.map do |partition, index|
14
+ next if index == 0 # already have the first partition
15
+ [index, Concurrent::Future.execute(executor: thread_pool) { retreive_proc.call(index) }]
17
16
  end
18
- end
19
- futures.each do |future|
20
- if future.rejected?
21
- if future.reason.is_a? RubySnowflake::Error
22
- raise future.reason
23
- else
24
- raise ConnectionStarvedError.new(
25
- "A partition request timed out. This is usually do to using the client in" \
26
- "multiple threads. The client uses a connection thread pool and if too many" \
27
- "requests are all done in threads at the same time, threads can get starved" \
28
- "of access to connections. The solution for this is to either increase the " \
29
- "max_connections parameter on the client or create a new client instance" \
30
- "with it's own connection pool to snowflake per thread. Rejection reason: #{future.reason.message}"
31
- )
17
+ .each do |entry|
18
+ next if entry.nil? # 0th index
19
+
20
+ index, future = entry
21
+ if future.rejected?
22
+ if future.reason.is_a? RubySnowflake::Error
23
+ raise future.reason
24
+ else
25
+ raise ConnectionStarvedError.new(
26
+ "A partition request timed out. This is usually do to using the client in" \
27
+ "multiple threads. The client uses a connection thread pool and if too many" \
28
+ "requests are all done in threads at the same time, threads can get starved" \
29
+ "of access to connections. The solution for this is to either increase the " \
30
+ "max_connections parameter on the client or create a new client instance" \
31
+ "with it's own connection pool to snowflake per thread. Rejection reason: #{future.reason.message}"
32
+ )
33
+ end
32
34
  end
35
+ result[index] = future.value
33
36
  end
34
- index, partition_data = future.value
35
- result[index] = partition_data
36
- end
37
37
  result
38
38
  end
39
39
  end
@@ -28,8 +28,19 @@ module RubySnowflake
28
28
 
29
29
  def initialize(details)
30
30
  @sentry_context = details
31
+ @details = details
32
+ end
33
+
34
+ def message
35
+ if @details == {}
36
+ super
37
+ else
38
+ @details.to_s
39
+ end
40
+
31
41
  end
32
42
  end
43
+
33
44
  class BadResponseError < Error ; end
34
45
  class ConnectionError < Error ; end
35
46
  class ConnectionStarvedError < Error ; end
@@ -249,9 +260,10 @@ module RubySnowflake
249
260
  loop do
250
261
  sleep POLLING_INTERVAL
251
262
 
252
- if Time.now.to_i - query_start_time > @query_timeout
263
+ elapsed_time = Time.now.to_i - query_start_time
264
+ if elapsed_time > @query_timeout
253
265
  cancelled = attempt_to_cancel_and_silence_errors(connection, statement_handle)
254
- raise QueryTimeoutError.new("Query timed out. Query cancelled? #{cancelled} Query: #{query}")
266
+ raise QueryTimeoutError.new("Query timed out. Query cancelled? #{cancelled}; Duration: #{elapsed_time}; Query: '#{query}'")
255
267
  end
256
268
 
257
269
  poll_response = request_with_auth_and_headers(connection, Net::HTTP::Get,
@@ -1,3 +1,3 @@
1
1
  module RubySnowflake
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.5"
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.3
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rinsed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-09 00:00:00.000000000 Z
11
+ date: 2024-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby