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 +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/ruby_snowflake/client/threaded_in_memory_strategy.rb +22 -22
- data/lib/ruby_snowflake/client.rb +14 -2
- data/lib/ruby_snowflake/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3fe7c88a471538362f7f852e9e0f0e1cc65413cecc9f308b21781325d4f8e99
|
4
|
+
data.tar.gz: 251bdb1fdb3b86919e2aac8714899fd69711813196d1109a6eb8d22e49f150ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd65b3d146f72a8109f4f7654658e911accc108451dbc15f42dd083e01e7db3499231029fd9e911fcfa76f2bc938f0329fed07ee9fad10523d56f1fb894137e0
|
7
|
+
data.tar.gz: 4368e68ca241e0563e6c2d2e408315dc0ef7648b66340d7ac137d4504f90f358ddb3d6145adbe1cdda0ed03c75ebd64a5d1d51e589be79c991654fa0608b38da
|
data/.github/workflows/ci.yml
CHANGED
@@ -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:
|
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
@@ -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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
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,
|
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.
|
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-
|
11
|
+
date: 2024-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|