rb_snowflake_client 0.3.0 → 1.0.1

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: b345626b574463c788bc7ff125c6297eac071ce62cd77fadb77c5da896f6089d
4
- data.tar.gz: 3bed923cc293d33af04eb846241637d6c72a8bef8917958e50b013fa8d120f70
3
+ metadata.gz: 721067a7c603fedbdfb6eb31f48dd617ea5380fd46188c213f7ca756184c4fe9
4
+ data.tar.gz: e92cc21bd08b0054522c70d0f5b80bad3fb02e922ced776e43fbc4f59fdd9f60
5
5
  SHA512:
6
- metadata.gz: 952d6ffe14f350158abbe2342815687e36564233f7de8a452c27174f2f483f76c32e331502a1a35e7e20a654f11a74c109f7018410a9a3add7f7fa42ea3e32c7
7
- data.tar.gz: 3dcc696ab574bebb3b0416dbc9595df656c6547f7b4a36b70d32d63030dfedc54d9f84e8b9838c0fd22c3cb5a9b9ce0efdc9c74b78e3bb41a57e58c29757c120
6
+ metadata.gz: de1bf89ab1276a8021d67ed7bfd08205cd64affb695dab1397b205f2c970006e014c078fbc6ad617925c18c8ec2dcdf9a42d3e77e658c7e859d453142409f28b
7
+ data.tar.gz: a02999829b5b92afc56a39f628334a15399099831c6ae818c3591b944984124e7d176c33c437e29c8644b7ae1703ad465732e6dcefc4fc05f4e8ffd253c5a7c3
@@ -0,0 +1,134 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual
11
+ identity and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the overall
27
+ community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or advances of
32
+ any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email address,
36
+ without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official email address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ [INSERT CONTACT METHOD].
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or permanent
94
+ ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within the
114
+ community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
+ [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
134
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rb_snowflake_client (0.3.0)
4
+ rb_snowflake_client (1.0.1)
5
5
  concurrent-ruby (>= 1.2)
6
6
  connection_pool (>= 2.4)
7
7
  dotenv (>= 2.8)
data/README.md CHANGED
@@ -9,15 +9,15 @@ The available options for connecting from Ruby to Snowflake include:
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
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
- * It will comsume 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.
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
15
15
 
16
16
  ## Create a client
17
17
 
18
- Add to your Gemfile or use `gem install rb-snowflake-client`
18
+ Add to your Gemfile or use `gem install rb_snowflake_client`
19
19
  ```ruby
20
- gem "rb-snowflake-client"
20
+ gem "rb_snowflake_client"
21
21
  ```
22
22
 
23
23
  Then require, create a client
@@ -107,14 +107,14 @@ client.query("SELECT * FROM BIGTABLE", warehouse: "FAST_WH")
107
107
 
108
108
  # Configuration Options
109
109
 
110
- The client supports the following configuration options, each with their own getter/setter except connection pool options which must be set at construction. Additionally, all except logger can be configured with environment variables (see above, but the pattern is like: "SNOWFLAKE_HTTP_RETRIES". Configuration options can only be set on initiialization through `new` or `from_env`.
110
+ The client supports the following configuration options, each with their own getter/setter except connection pool options which must be set at construction. Additionally, all except logger can be configured with environment variables (see above, but the pattern is like: "SNOWFLAKE_HTTP_RETRIES". Configuration options can only be set on initialization through `new` or `from_env`.
111
111
 
112
112
  - `logger` - takes any ruby logger (by default it's a std lib Logger.new(STDOUT), set at DEBUG level. Not available as an ENV variable config option
113
113
  - `log_level` - takes a log level, type is dependent on logger, for the default ruby Logger, use a level like `Logger::WARN`. Not available as an ENV variable config option.
114
114
  - `jwt_token_ttl` - The time to live set on JWT token in seconds, defaults to 3540 (59 minutes, the longest Snowflake supports is 60).
115
115
  - `connection_timeout` - The amount of time in seconds that the client's connection pool will wait before erroring in handing out a valid connection, defaults to 60 seconds
116
116
  - `max_connections` - The maximum number of http connections to hold open in the connection pool. If you use the client in a threaded context, you may need to increase this to be threads * client.max_threads_per_query, defaults to 16.
117
- - `max_threads_per_query` - The maximum number of threads the client should use to retreive data, per query, defaults to 8. If you want the client to act in a single threaded way, set this to 1
117
+ - `max_threads_per_query` - The maximum number of threads the client should use to retrieve data, per query, defaults to 8. If you want the client to act in a single threaded way, set this to 1
118
118
  - `thread_scale_factor` - When downloading a result set into memory, thread count is calculated by dividing a query's partition count by this number. For details on implementation see the code in `client.rb`.
119
119
  - `http_retries` - By default the client will retry common typically transient errors (http responses) twice, you can change the number of retries with this.
120
120
  - `query_timeout` - By default the client will wait 10 minutes (600s) for a query to finish, you can change this default, will also set this limit in the query for snowflake to obey. Set in seconds.
@@ -188,6 +188,14 @@ client = RubySnowflake::Client.new(
188
188
  )
189
189
  ```
190
190
 
191
+ # Code of conduct
192
+
193
+ See [Code of Coduct](CODE_OF_CONDUCT.md)
194
+
195
+ # Contributing
196
+
197
+ Please fork and create a pull request. Getting tests to run will be the most labor intensive part. You'll want to have an active snowflake account, and then configure your `.env` for the tests to be able to connect to your instance. Inside of `client_spec.rb` there are SQL statements to create the required tables. A pull request to make this less manual is also welcome :-). We'll do our best to help you along. Also, feel free to use Issues to report issues. [We](https://rinsed.co) use this client in production today, so we're happy to look at issues, especially where performance or correctness is involved.
198
+
191
199
  # Links:
192
200
  - snowflake API reference https://docs.snowflake.com/en/developer-guide/sql-api/reference
193
201
  - snowflake authentication docs: https://docs.snowflake.com/en/developer-guide/sql-api/authenticating
@@ -156,6 +156,13 @@ module RubySnowflake
156
156
  value = ENV[env_var_name]
157
157
  value.nil? || value.empty? ? default_value : ENV[env_var_name].to_i
158
158
  end
159
+
160
+ # This method can be used to populate the JWT token used for authentication
161
+ # in tests that require time travel.
162
+ def create_jwt_token
163
+ @key_pair_jwt_auth_manager.jwt_token
164
+ end
165
+
159
166
  private_class_method :env_option
160
167
 
161
168
  private
@@ -1,3 +1,3 @@
1
1
  module RubySnowflake
2
- VERSION = "0.3.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -11,7 +11,8 @@ Gem::Specification.new do |s|
11
11
  s.description = <<~DESC
12
12
  Using the HTTP V2 Api for Snowflake runs queries & creates native Ruby objects.
13
13
  DESC
14
- s.license = "MIT" # TODO: double check
14
+ s.homepage = "https://github.com/rinsed-org/rb-snowflake-client"
15
+ s.license = "MIT"
15
16
 
16
17
  s.files = Dir.chdir(File.expand_path(__dir__)) do
17
18
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|vendor)/}) }
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: 0.3.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rinsed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-08 00:00:00.000000000 Z
11
+ date: 2024-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -109,6 +109,7 @@ files:
109
109
  - ".github/workflows/release-gh-packages.yml"
110
110
  - ".github/workflows/release-rubygems.yml"
111
111
  - ".gitignore"
112
+ - CODE_OF_CONDUCT.md
112
113
  - Gemfile
113
114
  - Gemfile.lock
114
115
  - LICENSE.txt
@@ -125,9 +126,8 @@ files:
125
126
  - lib/ruby_snowflake/row.rb
126
127
  - lib/ruby_snowflake/streaming_result.rb
127
128
  - lib/ruby_snowflake/version.rb
128
- - private_key_pkcs8.pem
129
129
  - rb_snowflake_client.gemspec
130
- homepage:
130
+ homepage: https://github.com/rinsed-org/rb-snowflake-client
131
131
  licenses:
132
132
  - MIT
133
133
  metadata: {}
@@ -1,28 +0,0 @@
1
- -----BEGIN PRIVATE KEY-----
2
- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHwVo+6zP1f0wK
3
- +/SHc3e/VBqu7JTWK8ezyMuOjqJ3MtIck8aTufctJd6sjDn8uSF8DbuJsmPbbn98
4
- oWc/L5eCJ1uETgGW9J2hWB0wftYHVkLc+kDDCod4yKwjNqvA7BS7qYvIb1VjnlyI
5
- oljwLADnG3X2mBWxeD+Vw5rvaMOMr4TF1IA3orZOpIqqrvvLN4jlyt6yWfLlW4AZ
6
- NtnLcG1aTTODXHPz4Lit6Ag6VKgWvOfV7jAepsW/bMUW85ELYtXcdcVFodgKUHuN
7
- ZE3VsWOibqBGmJM7xuwJI8qLRqfEw3yq3UvDZ3/5zB7PELAjrE8sLsmFlh3Hq76E
8
- LSDc9Uo9AgMBAAECggEADvKy5mjy7TDet6a1nIpBQIXSblshYyqJCfTheLRHR5y7
9
- uOw9DLJ6ovwFvwtKTpVrAk3DxjDdhJ7u9txcLdAJqjF4SX0N5OY+woNlwcqICSoF
10
- HGS0wnOwAhOgQA1YCnqQLZ/pKDFepjMEUSw29BgS5Dh7mh205+Ar//DQkBBaq9UX
11
- uZtw3dKKmDPcWdPfFjFJQrH9YrrDdt+rcOULIk4iyzepA7nLV9RBiuir256Pnmi8
12
- +aXzPkl7PjMgCrDvqx47+Kjxcvccq/yt0zlNuEBDKOa9ChPd6FOV8O64IknBl/Eq
13
- xU/2+06XI5QEuk9k1MKyMO06fOWS/3XSpOBSa1pooQKBgQDuiFk1897Bsxz5wwvb
14
- vwRVoVHhNcmWLixMiWggRvnDWfDKzm7lGKTAzrgafNnw84NPD0nvcgDXivzQpEgX
15
- Ge/SSZzn3DD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