trino-client 2.2.4 → 2.2.6
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/ChangeLog.md +26 -0
- data/README.md +7 -8
- data/lib/trino/client/faraday_client.rb +1 -1
- data/lib/trino/client/statement_client.rb +49 -29
- data/lib/trino/client/version.rb +1 -1
- data/trino-client.gemspec +3 -3
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 69f501fb237b50a19cab4a4ca36e5702ce0b6852aa4f47c28cc58ee2bf9b0b56
|
|
4
|
+
data.tar.gz: 0505db32b400bd17516b49b7c151c5717a95cd6316f3a0a91258409e483822c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f31ffb1267de01b418f3a39c244dcf34dc8f3dd2d5d3bff3e15c6dc6b8aef1c701ec70ac46c5b85f08a1de89094e0be0198439083e9a57b337bb72c6c3f549e7
|
|
7
|
+
data.tar.gz: 77aeab61775faadb4cd79f567089cb3cfd25c86e3a6d5469ae82da589ad2b88ca59f5e982c49d9aba3832960dc50c1236246913098bc1422587e80cdebb1e475
|
data/ChangeLog.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
trino-client-ruby
|
|
2
2
|
====
|
|
3
|
+
## 2.2.6
|
|
4
|
+
- fix: improve POST retry tests and document idempotency assumption ([#159](https://github.com/treasure-data/trino-client-ruby/issues/159)) [[e64c2a9](https://github.com/treasure-data/trino-client-ruby/commit/e64c2a9)]
|
|
5
|
+
- Add retry to POST /v1/statement ([#157](https://github.com/treasure-data/trino-client-ruby/issues/157)) [[64a5c66](https://github.com/treasure-data/trino-client-ruby/commit/64a5c66)]
|
|
6
|
+
- Update psych requirement from ~> 3 to ~> 5 ([#140](https://github.com/treasure-data/trino-client-ruby/issues/140)) [[eeb3333](https://github.com/treasure-data/trino-client-ruby/commit/eeb3333)]
|
|
7
|
+
- Update dependabot.yaml to change the update interval from weekly to monthly and set commit message prefix to "chore". [[2fde3f2](https://github.com/treasure-data/trino-client-ruby/commit/2fde3f2)]
|
|
8
|
+
- Minor fix [[db03c07](https://github.com/treasure-data/trino-client-ruby/commit/db03c07)]
|
|
9
|
+
- Update addressable requirement from ~> 2.8.1 to ~> 2.9.0 [[1a56064](https://github.com/treasure-data/trino-client-ruby/commit/1a56064)]
|
|
10
|
+
- Update README.md for release instructions [skip ci] [[dda6a06](https://github.com/treasure-data/trino-client-ruby/commit/dda6a06)]
|
|
11
|
+
- v2.2.5 [[12ce8e8](https://github.com/treasure-data/trino-client-ruby/commit/12ce8e8)]
|
|
12
|
+
|
|
13
|
+
## 2.2.5
|
|
14
|
+
- Merge pull request [#155](https://github.com/treasure-data/trino-client-ruby/issues/155) from murakami-ta/add-http-debug-logger-option [[143a801](https://github.com/treasure-data/trino-client-ruby/commit/143a801)]
|
|
15
|
+
- Fix http_debug_logger test to work with both Faraday 1 and 2 [[0976be7](https://github.com/treasure-data/trino-client-ruby/commit/0976be7)]
|
|
16
|
+
- Add http_debug_logger option [[b54b20a](https://github.com/treasure-data/trino-client-ruby/commit/b54b20a)]
|
|
17
|
+
- Bump rubygems/release-gem from 1.1.4 to 1.2.0 ([#153](https://github.com/treasure-data/trino-client-ruby/issues/153)) [[52e0e30](https://github.com/treasure-data/trino-client-ruby/commit/52e0e30)]
|
|
18
|
+
- Bump release-drafter/release-drafter from 6 to 7 ([#152](https://github.com/treasure-data/trino-client-ruby/issues/152)) [[851d586](https://github.com/treasure-data/trino-client-ruby/commit/851d586)]
|
|
19
|
+
- Bump rubygems/release-gem from 1.1.2 to 1.1.4 ([#151](https://github.com/treasure-data/trino-client-ruby/issues/151)) [[bca14ae](https://github.com/treasure-data/trino-client-ruby/commit/bca14ae)]
|
|
20
|
+
- Update standard requirement from ~> 1.51.1 to ~> 1.54.0 ([#150](https://github.com/treasure-data/trino-client-ruby/issues/150)) [[9dc220e](https://github.com/treasure-data/trino-client-ruby/commit/9dc220e)]
|
|
21
|
+
- Bump actions/checkout from 5 to 6 ([#147](https://github.com/treasure-data/trino-client-ruby/issues/147)) [[76f9954](https://github.com/treasure-data/trino-client-ruby/commit/76f9954)]
|
|
22
|
+
- Bump github/codeql-action from 3 to 4 ([#145](https://github.com/treasure-data/trino-client-ruby/issues/145)) [[3065e2a](https://github.com/treasure-data/trino-client-ruby/commit/3065e2a)]
|
|
23
|
+
- Update standard requirement from ~> 1.50.0 to ~> 1.51.1 ([#143](https://github.com/treasure-data/trino-client-ruby/issues/143)) [[be846e0](https://github.com/treasure-data/trino-client-ruby/commit/be846e0)]
|
|
24
|
+
- Bump rubygems/release-gem ([#146](https://github.com/treasure-data/trino-client-ruby/issues/146)) [[9821efc](https://github.com/treasure-data/trino-client-ruby/commit/9821efc)]
|
|
25
|
+
- Add DeepWiki badge to README [skip ci] [[82afa57](https://github.com/treasure-data/trino-client-ruby/commit/82afa57)]
|
|
26
|
+
- Update release.rb to increment the version in @lib/trino/client/version.rb [[c2bff61](https://github.com/treasure-data/trino-client-ruby/commit/c2bff61)]
|
|
27
|
+
- Bump actions/checkout from 4 to 5, etc ([#142](https://github.com/treasure-data/trino-client-ruby/issues/142)) [[17eb1d2](https://github.com/treasure-data/trino-client-ruby/commit/17eb1d2)]
|
|
28
|
+
|
|
3
29
|
## 2.2.4
|
|
4
30
|
- Add steps to publish trino-client-ruby [[228f709](https://github.com/treasure-data/trino-client-ruby/commit/228f709)]
|
|
5
31
|
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Trino client library for Ruby
|
|
2
2
|
|
|
3
3
|
[](https://github.com/treasure-data/trino-client-ruby/actions/workflows/ruby.yml) [](https://rubygems.org/gems/trino-client) [](https://rubygems.org/gems/trino-client) []()
|
|
4
|
+
[](https://deepwiki.com/treasure-data/trino-client-ruby)
|
|
4
5
|
|
|
5
6
|
Trino is a distributed SQL query engine for big data:
|
|
6
7
|
https://trino.io/
|
|
@@ -112,6 +113,7 @@ $ bundle exec rake modelgen:latest
|
|
|
112
113
|
* **http_headers** sets custom HTTP headers. It must be a Hash of string to string.
|
|
113
114
|
* **http_proxy** sets host:port of a HTTP proxy server.
|
|
114
115
|
* **http_debug** enables debug message to STDOUT for each HTTP requests.
|
|
116
|
+
* **http_debug_logger** sets a custom `Logger` instance for HTTP debug logs. Requires **http_debug** to be `true`.
|
|
115
117
|
* **http_open_timeout** sets timeout in seconds to open new HTTP connection.
|
|
116
118
|
* **http_timeout** sets timeout in seconds to read data from a server.
|
|
117
119
|
* **gzip** enables gzip compression.
|
|
@@ -124,20 +126,17 @@ See [RDoc](http://www.rubydoc.info/gems/presto-client/) for the full documentati
|
|
|
124
126
|
|
|
125
127
|
### Releasing a new version
|
|
126
128
|
|
|
127
|
-
1.
|
|
128
|
-
2. Run the following command which will update `ChangeLog.md` file automatically.
|
|
129
|
+
1. Run the following command which will prompt for the new version, update `lib/trino/client/version.rb`, and generate/let you edit `ChangeLog.md`.
|
|
129
130
|
```
|
|
130
131
|
$ ruby release.rb
|
|
131
132
|
```
|
|
132
133
|
|
|
133
|
-
|
|
134
|
+
2. Commit and tag
|
|
134
135
|
```
|
|
135
136
|
$ git commit -am "vX.Y.Z"
|
|
136
137
|
$ git tag "vX.Y.Z"
|
|
137
|
-
|
|
138
|
+
$ git push origin master
|
|
139
|
+
$ git push --tags
|
|
138
140
|
```
|
|
139
141
|
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
$ ruby publish.rb
|
|
143
|
-
```
|
|
142
|
+
Pushing a `v*` tag triggers the GitHub Actions publisher workflow, which automatically builds and publishes the gem to RubyGems.org.
|
|
@@ -26,6 +26,8 @@ module Trino::Client
|
|
|
26
26
|
:max_nesting => false
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
RETRYABLE_STATUSES = [502, 503, 504]
|
|
30
|
+
|
|
29
31
|
def initialize(faraday, query, options, next_uri=nil)
|
|
30
32
|
@faraday = faraday
|
|
31
33
|
|
|
@@ -66,16 +68,31 @@ module Trino::Client
|
|
|
66
68
|
|
|
67
69
|
def post_query_request!
|
|
68
70
|
uri = "/v1/statement"
|
|
69
|
-
response =
|
|
70
|
-
|
|
71
|
+
response = with_retry_loop do
|
|
72
|
+
begin
|
|
73
|
+
r = @faraday.post do |req|
|
|
74
|
+
req.url uri
|
|
71
75
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
req.body = @query
|
|
77
|
+
init_request(req)
|
|
78
|
+
end
|
|
79
|
+
rescue Faraday::TimeoutError, Faraday::ConnectionFailed
|
|
80
|
+
# POST /v1/statement is not idempotent; retrying transport-level errors
|
|
81
|
+
# (timeouts/connection failures) can submit duplicate queries. This is
|
|
82
|
+
# intentional under the assumption the failure happened before Trino
|
|
83
|
+
# received the request (e.g. rejected by a load balancer upstream).
|
|
84
|
+
throw :retry_with_backoff
|
|
85
|
+
rescue => e
|
|
86
|
+
exception! e
|
|
87
|
+
end
|
|
75
88
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
if r.status == 200
|
|
90
|
+
r
|
|
91
|
+
elsif RETRYABLE_STATUSES.include?(r.status)
|
|
92
|
+
throw :retry_with_backoff
|
|
93
|
+
else
|
|
94
|
+
exception! TrinoHttpError.new(r.status, "Failed to start query: #{r.body} (#{r.status})")
|
|
95
|
+
end
|
|
79
96
|
end
|
|
80
97
|
|
|
81
98
|
@results_headers = response.headers
|
|
@@ -189,31 +206,12 @@ module Trino::Client
|
|
|
189
206
|
|
|
190
207
|
private :parse_body
|
|
191
208
|
|
|
192
|
-
def
|
|
209
|
+
def with_retry_loop
|
|
193
210
|
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
194
211
|
attempts = 0
|
|
195
212
|
|
|
196
213
|
loop do
|
|
197
|
-
|
|
198
|
-
response = @faraday.get(uri)
|
|
199
|
-
rescue Faraday::TimeoutError, Faraday::ConnectionFailed
|
|
200
|
-
# temporally error to retry
|
|
201
|
-
response = nil
|
|
202
|
-
rescue => e
|
|
203
|
-
exception! e
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
if response
|
|
207
|
-
if response.status == 200 && !response.body.to_s.empty?
|
|
208
|
-
return response
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
# retry if 502, 503, 504 according to the trino protocol
|
|
212
|
-
unless [502, 503, 504].include?(response.status)
|
|
213
|
-
# deterministic error
|
|
214
|
-
exception! TrinoHttpError.new(response.status, "Trino API error at #{uri} returned #{response.status}: #{response.body}")
|
|
215
|
-
end
|
|
216
|
-
end
|
|
214
|
+
catch(:retry_with_backoff) { return yield }
|
|
217
215
|
|
|
218
216
|
raise_if_timeout!
|
|
219
217
|
|
|
@@ -226,6 +224,28 @@ module Trino::Client
|
|
|
226
224
|
exception! TrinoHttpError.new(408, "Trino API error due to timeout")
|
|
227
225
|
end
|
|
228
226
|
|
|
227
|
+
private :with_retry_loop
|
|
228
|
+
|
|
229
|
+
def faraday_get_with_retry(uri)
|
|
230
|
+
with_retry_loop do
|
|
231
|
+
begin
|
|
232
|
+
response = @faraday.get(uri)
|
|
233
|
+
rescue Faraday::TimeoutError, Faraday::ConnectionFailed
|
|
234
|
+
throw :retry_with_backoff
|
|
235
|
+
rescue => e
|
|
236
|
+
exception! e
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
if response.status == 200 && !response.body.to_s.empty?
|
|
240
|
+
response
|
|
241
|
+
elsif RETRYABLE_STATUSES.include?(response.status)
|
|
242
|
+
throw :retry_with_backoff
|
|
243
|
+
else
|
|
244
|
+
exception! TrinoHttpError.new(response.status, "Trino API error at #{uri} returned #{response.status}: #{response.body}")
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
|
|
229
249
|
def raise_if_timeout!
|
|
230
250
|
if @started_at
|
|
231
251
|
return if finished?
|
data/lib/trino/client/version.rb
CHANGED
data/trino-client.gemspec
CHANGED
|
@@ -29,8 +29,8 @@ Gem::Specification.new do |gem|
|
|
|
29
29
|
gem.add_development_dependency "rake", [">= 0.9.2", "< 14.0"]
|
|
30
30
|
gem.add_development_dependency "rspec", "~> 3.13.0"
|
|
31
31
|
gem.add_development_dependency "webmock", ["~> 3.0"]
|
|
32
|
-
gem.add_development_dependency "addressable", "~> 2.
|
|
32
|
+
gem.add_development_dependency "addressable", "~> 2.9.0"
|
|
33
33
|
gem.add_development_dependency "simplecov", "~> 0.22.0"
|
|
34
|
-
gem.add_development_dependency "standard", "~> 1.
|
|
35
|
-
gem.add_development_dependency "psych", "~>
|
|
34
|
+
gem.add_development_dependency "standard", "~> 1.54.0"
|
|
35
|
+
gem.add_development_dependency "psych", "~> 5"
|
|
36
36
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trino-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sadayuki Furuhashi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-06-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -126,14 +126,14 @@ dependencies:
|
|
|
126
126
|
requirements:
|
|
127
127
|
- - "~>"
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: 2.
|
|
129
|
+
version: 2.9.0
|
|
130
130
|
type: :development
|
|
131
131
|
prerelease: false
|
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
|
133
133
|
requirements:
|
|
134
134
|
- - "~>"
|
|
135
135
|
- !ruby/object:Gem::Version
|
|
136
|
-
version: 2.
|
|
136
|
+
version: 2.9.0
|
|
137
137
|
- !ruby/object:Gem::Dependency
|
|
138
138
|
name: simplecov
|
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -154,28 +154,28 @@ dependencies:
|
|
|
154
154
|
requirements:
|
|
155
155
|
- - "~>"
|
|
156
156
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: 1.
|
|
157
|
+
version: 1.54.0
|
|
158
158
|
type: :development
|
|
159
159
|
prerelease: false
|
|
160
160
|
version_requirements: !ruby/object:Gem::Requirement
|
|
161
161
|
requirements:
|
|
162
162
|
- - "~>"
|
|
163
163
|
- !ruby/object:Gem::Version
|
|
164
|
-
version: 1.
|
|
164
|
+
version: 1.54.0
|
|
165
165
|
- !ruby/object:Gem::Dependency
|
|
166
166
|
name: psych
|
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
|
168
168
|
requirements:
|
|
169
169
|
- - "~>"
|
|
170
170
|
- !ruby/object:Gem::Version
|
|
171
|
-
version: '
|
|
171
|
+
version: '5'
|
|
172
172
|
type: :development
|
|
173
173
|
prerelease: false
|
|
174
174
|
version_requirements: !ruby/object:Gem::Requirement
|
|
175
175
|
requirements:
|
|
176
176
|
- - "~>"
|
|
177
177
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '
|
|
178
|
+
version: '5'
|
|
179
179
|
description: Trino client library
|
|
180
180
|
email:
|
|
181
181
|
- sf@treasure-data.com
|