rb_snowflake_client 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/ruby_snowflake/client.rb +7 -3
- 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: af3e56d97ebae43ae931c9c50784d7a3af0fe0e4a70f7e2a28c932d30371eff5
|
4
|
+
data.tar.gz: cdd2e9f55805e8d27e344925b8917b6d292aa1b07ed87ac8443060d31e224ccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c3aae7bf833cab432ea952419e951f51584100766eccd07d3a978c449fd1a2fd532a5756a0789242ff1baa7319dc360a162ba608d502d12436837f456033b97
|
7
|
+
data.tar.gz: cf1828f9a00b3be7c6030c5bc3e6f1be834206e364be477aa944faffaaf3638dc65a61bbc215c6f7428fd103ee62a1077e9658fa08055479e632b29d15f008f7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
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
|
-
* The [ruby snowflake client]
|
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
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:
|
10
10
|
* It uses about half the memory when you pull a full result set into memory
|
11
|
-
* It does not hold onto the [ruby GVL]
|
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.
|
13
13
|
|
14
14
|
# Usage
|
@@ -128,7 +128,7 @@ module RubySnowflake
|
|
128
128
|
@_enable_polling_queries = false
|
129
129
|
end
|
130
130
|
|
131
|
-
def query(query, warehouse: nil, streaming: false, database: nil)
|
131
|
+
def query(query, warehouse: nil, streaming: false, database: nil, schema: nil)
|
132
132
|
warehouse ||= @default_warehouse
|
133
133
|
database ||= @default_database
|
134
134
|
|
@@ -136,8 +136,11 @@ module RubySnowflake
|
|
136
136
|
response = nil
|
137
137
|
connection_pool.with do |connection|
|
138
138
|
request_body = {
|
139
|
-
"
|
140
|
-
"
|
139
|
+
"database" => database&.upcase,
|
140
|
+
"schema" => schema&.upcase,
|
141
|
+
"statement" => query,
|
142
|
+
"timeout" => @query_timeout,
|
143
|
+
"warehouse" => warehouse&.upcase,
|
141
144
|
}
|
142
145
|
|
143
146
|
response = request_with_auth_and_headers(
|
@@ -190,6 +193,7 @@ module RubySnowflake
|
|
190
193
|
request.body = body unless body.nil?
|
191
194
|
|
192
195
|
Retryable.retryable(tries: @http_retries + 1,
|
196
|
+
sleep: lambda {|n| 2**n }, # 1, 2, 4, 8, etc
|
193
197
|
on: [RetryableBadResponseError, OpenSSL::SSL::SSLError],
|
194
198
|
log_method: retryable_log_method) do
|
195
199
|
response = nil
|
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.0.
|
4
|
+
version: 1.0.6
|
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-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|