altertable-lakehouse 0.9.0 → 0.10.0
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/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +2 -1
- data/lib/altertable/lakehouse/adapters.rb +30 -17
- data/lib/altertable/lakehouse/client.rb +76 -35
- data/lib/altertable/lakehouse/models.rb +24 -6
- data/lib/altertable/lakehouse/version.rb +1 -1
- data/rbi/altertable/lakehouse.rbi +80 -15
- data/rbi/todo.rbi +2 -0
- data/sig/altertable/lakehouse/adapters.rbs +1 -0
- data/sig/altertable/lakehouse/client.rbs +18 -1
- data/sig/altertable/lakehouse/models.rbs +30 -10
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bc216c58c6d19bb15aff580cda0bdc95254b6aa9995e4d6c5480876314e11665
|
|
4
|
+
data.tar.gz: 838bc09df3b5ffb6d60f28a73576fe1005b838c126be899a1e5e071e44713f84
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d83c2091e31e688f2eb3ab338170fc991f432e883a88b8c7b6d1f655a699240abbddf83439decf2869c65f60dc39e8d4406f7b963504002d779c3b5b01f7bed1
|
|
7
|
+
data.tar.gz: a8cf6157ad97f10e46875adeccc79165c8b032c27825627d2da29352bce5dfd0948e90050223922f34f07d51ed0bd63ba248e4b5a92ac8ed0bca6611a93a2c6c
|
data/CHANGELOG.md
CHANGED
|
@@ -8,16 +8,35 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
* Support named and positional bind values through `QueryRequest#params`.
|
|
10
10
|
* `ColumnDescriptor` value objects (`Data`) for query columns, with `name` and `type` readers.
|
|
11
|
+
* `QueryLogResponse` exposes `threads`, `fingerprint`, `session_catalog`, and `session_schema`.
|
|
11
12
|
|
|
12
13
|
### Changed
|
|
13
14
|
|
|
14
15
|
* Require Ruby 3.2 or newer (`ColumnDescriptor` is a `Data` class). CI already only tested 3.2+.
|
|
16
|
+
* `query` streams its result: rows are parsed and yielded as `/query` chunks arrive, instead of after the whole body is held in memory. This works with the Faraday, HTTPX and Net::HTTP adapters.
|
|
17
|
+
* A malformed `/query` NDJSON line now raises `ParseError` instead of being skipped.
|
|
15
18
|
|
|
16
19
|
### Fixed
|
|
17
20
|
|
|
21
|
+
* `QueryLogResponse#progress` is no longer always `nil`.
|
|
22
|
+
* `query` works with the HTTPX adapter. It raised `HTTPX::Error: invalid URI: /query` because the streamed request lost the client's base URL.
|
|
18
23
|
* `QueryResult#columns` and `query_all[:columns]` return typed column descriptors again instead of bare names; rows stay keyed by column name.
|
|
19
24
|
* A malformed `/query` column line (anything other than an array of `{ "name", "type" }` string objects) now raises `ParseError` instead of passing through untyped.
|
|
20
25
|
|
|
26
|
+
## [0.10.0](https://github.com/altertable-ai/altertable-lakehouse-ruby/compare/altertable-lakehouse/v0.9.1...altertable-lakehouse/v0.10.0) (2026-11-06)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **query:** stream /query rows as chunks arrive ([#64](https://github.com/altertable-ai/altertable-lakehouse-ruby/issues/64)) ([493395e](https://github.com/altertable-ai/altertable-lakehouse-ruby/commit/493395e7577e766f24a42ba6f50d7c1b6d99957f))
|
|
32
|
+
|
|
33
|
+
## [0.9.1](https://github.com/altertable-ai/altertable-lakehouse-ruby/compare/altertable-lakehouse/v0.9.0...altertable-lakehouse/v0.9.1) (2026-11-03)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* **query:** read query log progress from top-level fields ([#60](https://github.com/altertable-ai/altertable-lakehouse-ruby/issues/60)) ([d73f6e2](https://github.com/altertable-ai/altertable-lakehouse-ruby/commit/d73f6e2041d05fff2cdfa793da42f2ff67b8e413))
|
|
39
|
+
|
|
21
40
|
## [0.9.0](https://github.com/altertable-ai/altertable-lakehouse-ruby/compare/altertable-lakehouse/v0.8.2...altertable-lakehouse/v0.9.0) (2026-10-12)
|
|
22
41
|
|
|
23
42
|
|
data/Gemfile.lock
CHANGED
|
@@ -56,7 +56,8 @@ module Altertable
|
|
|
56
56
|
req.params = params if params
|
|
57
57
|
req.headers = req.headers.merge(headers) unless headers.empty?
|
|
58
58
|
req.body = body
|
|
59
|
-
|
|
59
|
+
# Faraday 2 passes the env, whose status is set before the first chunk.
|
|
60
|
+
req.options.on_data = proc { |chunk, _received, env| block.call(chunk, env&.status) } if block_given?
|
|
60
61
|
end
|
|
61
62
|
wrap_response(resp)
|
|
62
63
|
rescue Faraday::ConnectionFailed => e
|
|
@@ -93,7 +94,7 @@ module Altertable
|
|
|
93
94
|
base_url: @base_url
|
|
94
95
|
}
|
|
95
96
|
http_options[:proxy] = options[:proxy] if options.key?(:proxy)
|
|
96
|
-
@client = HTTPX.plugin(:retries).with(**http_options)
|
|
97
|
+
@client = HTTPX.plugin(:retries).plugin(:stream).with(**http_options)
|
|
97
98
|
end
|
|
98
99
|
|
|
99
100
|
def get(path, body: nil, params: {}, headers: {}, &_block) # rubocop:disable Lint/UnusedMethodArgument
|
|
@@ -101,22 +102,10 @@ module Altertable
|
|
|
101
102
|
wrap_response(resp)
|
|
102
103
|
end
|
|
103
104
|
|
|
104
|
-
def post(path, body: nil, params: {}, headers: {}, &
|
|
105
|
+
def post(path, body: nil, params: {}, headers: {}, &)
|
|
105
106
|
client = @client.with(headers: headers)
|
|
106
107
|
if block_given?
|
|
107
|
-
|
|
108
|
-
# HTTPX response streaming:
|
|
109
|
-
response = client.request("POST", path, body: body, params: params, stream: true)
|
|
110
|
-
|
|
111
|
-
# Check for error immediately
|
|
112
|
-
if response.is_a?(HTTPX::ErrorResponse)
|
|
113
|
-
raise Altertable::Lakehouse::NetworkError, response.error.message
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
response.body.each do |chunk|
|
|
117
|
-
block.call(chunk, response.headers["content-length"])
|
|
118
|
-
end
|
|
119
|
-
wrap_response(response)
|
|
108
|
+
stream_post(client, path, body: body, params: params, &)
|
|
120
109
|
else
|
|
121
110
|
resp = client.post(path, body: body, params: params)
|
|
122
111
|
wrap_response(resp)
|
|
@@ -130,6 +119,30 @@ module Altertable
|
|
|
130
119
|
|
|
131
120
|
private
|
|
132
121
|
|
|
122
|
+
# Yields body chunks as they arrive instead of buffering the body.
|
|
123
|
+
def stream_post(client, path, body:, params:, &block)
|
|
124
|
+
# The stream plugin drops the base_url origin, so pass a full URL.
|
|
125
|
+
url = "#{@base_url.to_s.chomp('/')}#{path}"
|
|
126
|
+
# It also sets a 60s operation timeout, so restore the configured
|
|
127
|
+
# one. operation_timeout bounds each wait on the socket (a late
|
|
128
|
+
# response or a stalled stream), like Net::HTTP's read_timeout. The
|
|
129
|
+
# plugin's infinite read_timeout stays: on a stream it would cap the
|
|
130
|
+
# whole response.
|
|
131
|
+
timeout = { operation_timeout: @timeout, connect_timeout: @open_timeout }
|
|
132
|
+
response = client.request("POST", url, body: body, params: params, stream: true, timeout: timeout)
|
|
133
|
+
begin
|
|
134
|
+
response.each { |chunk| block.call(chunk, response.status) }
|
|
135
|
+
rescue HTTPX::HTTPError => e
|
|
136
|
+
# Raised once a 4xx/5xx body has been streamed to the block.
|
|
137
|
+
return Response.new(e.response.status, nil, e.response.headers)
|
|
138
|
+
rescue HTTPX::TimeoutError => e
|
|
139
|
+
raise Altertable::Lakehouse::TimeoutError, e.message
|
|
140
|
+
rescue HTTPX::Error => e
|
|
141
|
+
raise Altertable::Lakehouse::NetworkError, e.message
|
|
142
|
+
end
|
|
143
|
+
Response.new(response.status, nil, response.headers)
|
|
144
|
+
end
|
|
145
|
+
|
|
133
146
|
def wrap_response(resp)
|
|
134
147
|
if resp.is_a?(HTTPX::ErrorResponse)
|
|
135
148
|
raise Altertable::Lakehouse::NetworkError, resp.error.message
|
|
@@ -178,7 +191,7 @@ module Altertable
|
|
|
178
191
|
# Stream the body if block is given
|
|
179
192
|
if response.is_a?(Net::HTTPSuccess)
|
|
180
193
|
response.read_body do |chunk|
|
|
181
|
-
block.call(chunk, response.
|
|
194
|
+
block.call(chunk, response.code.to_i)
|
|
182
195
|
end
|
|
183
196
|
end
|
|
184
197
|
# Return wrapped response (body might be empty if consumed?)
|
|
@@ -63,14 +63,15 @@ module Altertable
|
|
|
63
63
|
req_body = Models::QueryRequest.new(statement: statement, **).to_h.to_json
|
|
64
64
|
|
|
65
65
|
enum = Enumerator.new do |yielder|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
#
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
stream = NdjsonStream.new { |value| yielder << value }
|
|
67
|
+
|
|
68
|
+
# The adapter yields each body chunk with the response status (when
|
|
69
|
+
# it knows it), so rows reach the caller as they arrive.
|
|
70
|
+
resp = @adapter.post("/query", body: req_body, headers: json_headers(headers)) do |chunk, status|
|
|
71
|
+
stream.write(chunk, status)
|
|
71
72
|
end
|
|
72
73
|
|
|
73
|
-
handle_stream_response(resp,
|
|
74
|
+
handle_stream_response(resp, stream)
|
|
74
75
|
end
|
|
75
76
|
|
|
76
77
|
QueryResult.new(enum)
|
|
@@ -219,43 +220,27 @@ module Altertable
|
|
|
219
220
|
end
|
|
220
221
|
end
|
|
221
222
|
|
|
222
|
-
def handle_stream_response(resp,
|
|
223
|
+
def handle_stream_response(resp, stream)
|
|
223
224
|
case resp.status
|
|
225
|
+
when 200..299
|
|
226
|
+
stream.finish
|
|
224
227
|
when 400
|
|
225
|
-
raise BadRequestError, "Bad Request: #{
|
|
228
|
+
raise BadRequestError, "Bad Request: #{stream_error_body(resp, stream)}"
|
|
226
229
|
when 401
|
|
227
230
|
raise AuthError, "Unauthorized"
|
|
228
|
-
when 200..299
|
|
229
|
-
# Parse the accumulated NDJSON buffer line by line
|
|
230
|
-
# Buffer might be partial?
|
|
231
|
-
# In streaming, the block is called.
|
|
232
|
-
# Here we are processing after the stream is done?
|
|
233
|
-
# Wait, QueryResult expects the stream to be processed as it comes?
|
|
234
|
-
# The previous implementation used an Enumerator that yielded as data came in.
|
|
235
|
-
# Here, @adapter.post blocks until done?
|
|
236
|
-
# If @adapter.post blocks, we only get the buffer at the end.
|
|
237
|
-
# To stream truly, @adapter.post needs to yield to the block, which yields to yielder?
|
|
238
|
-
|
|
239
|
-
# Re-implementing streaming logic:
|
|
240
|
-
# The enumerator in `query` wraps the call.
|
|
241
|
-
# When `query` returns QueryResult, it hasn't run the request yet.
|
|
242
|
-
# Enumerator logic is inside.
|
|
243
|
-
|
|
244
|
-
buffer.each_line do |line|
|
|
245
|
-
line = line.strip
|
|
246
|
-
next if line.empty?
|
|
247
|
-
begin
|
|
248
|
-
yielder << JSON.parse(line)
|
|
249
|
-
rescue JSON::ParserError
|
|
250
|
-
# Partial line?
|
|
251
|
-
# For now assume full lines or handle buffering properly
|
|
252
|
-
end
|
|
253
|
-
end
|
|
254
231
|
else
|
|
255
|
-
raise ApiError, "API Error #{resp.status}: #{
|
|
232
|
+
raise ApiError, "API Error #{resp.status}: #{stream_error_body(resp, stream)}"
|
|
256
233
|
end
|
|
257
234
|
end
|
|
258
235
|
|
|
236
|
+
# Adapters stream error bodies to the block too, except Net::HTTP, which
|
|
237
|
+
# returns them in the response.
|
|
238
|
+
def stream_error_body(resp, stream)
|
|
239
|
+
body = stream.body
|
|
240
|
+
body = resp.body.to_s if body.empty?
|
|
241
|
+
body.strip
|
|
242
|
+
end
|
|
243
|
+
|
|
259
244
|
def handle_response(resp)
|
|
260
245
|
case resp.status
|
|
261
246
|
when 200..299
|
|
@@ -278,6 +263,62 @@ module Altertable
|
|
|
278
263
|
end
|
|
279
264
|
end
|
|
280
265
|
|
|
266
|
+
# Splits a /query NDJSON body into JSON values as chunks arrive, carrying a
|
|
267
|
+
# partial trailing line over to the next chunk. Until a chunk comes with a
|
|
268
|
+
# 2xx status, the body is only buffered: it may be an error message, or the
|
|
269
|
+
# adapter may not know the status before the response ends.
|
|
270
|
+
class NdjsonStream
|
|
271
|
+
def initialize(&on_value)
|
|
272
|
+
@on_value = on_value
|
|
273
|
+
@buffer = String.new(encoding: Encoding::BINARY)
|
|
274
|
+
@streaming = false
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def write(chunk, status)
|
|
278
|
+
@buffer << chunk.b
|
|
279
|
+
@streaming ||= !status.nil? && (200..299).cover?(status)
|
|
280
|
+
emit_complete_lines if @streaming
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# Emits whatever is left once the response ended with a 2xx status.
|
|
284
|
+
def finish
|
|
285
|
+
emit_complete_lines
|
|
286
|
+
emit(@buffer)
|
|
287
|
+
@buffer = String.new(encoding: Encoding::BINARY)
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# The buffered, not yet emitted body.
|
|
291
|
+
def body
|
|
292
|
+
@buffer.dup.force_encoding(Encoding::UTF_8)
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
private
|
|
296
|
+
|
|
297
|
+
def emit_complete_lines
|
|
298
|
+
last_newline = @buffer.rindex("\n")
|
|
299
|
+
return unless last_newline
|
|
300
|
+
|
|
301
|
+
complete = @buffer.byteslice(0..last_newline)
|
|
302
|
+
@buffer = @buffer.byteslice((last_newline + 1)..)
|
|
303
|
+
complete.each_line { |line| emit(line) }
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
def emit(line)
|
|
307
|
+
line = line.dup.force_encoding(Encoding::UTF_8).strip
|
|
308
|
+
return if line.empty?
|
|
309
|
+
|
|
310
|
+
@on_value.call(JSON.parse(line))
|
|
311
|
+
rescue JSON::ParserError => e
|
|
312
|
+
raise ParseError.new(
|
|
313
|
+
"Malformed /query line: #{e.message}",
|
|
314
|
+
operation: "query",
|
|
315
|
+
http_method: "POST",
|
|
316
|
+
http_path: "/query",
|
|
317
|
+
cause: e
|
|
318
|
+
)
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
|
|
281
322
|
ColumnDescriptor = Data.define(:name, :type)
|
|
282
323
|
|
|
283
324
|
class QueryResult
|
|
@@ -133,10 +133,14 @@ module Altertable
|
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
|
|
136
|
+
QueryProgress = Data.define(:percentage, :rows_processed, :total_rows)
|
|
137
|
+
|
|
136
138
|
class QueryLogResponse < Request
|
|
137
|
-
attr_reader :uuid, :start_time, :end_time, :duration_ms, :query, :session_id, :client_interface, :error, :stats, :
|
|
139
|
+
attr_reader :uuid, :start_time, :end_time, :duration_ms, :query, :session_id, :client_interface, :error, :stats, :visible, :requested_by, :user_agent,
|
|
140
|
+
:threads, :fingerprint, :session_catalog, :session_schema
|
|
138
141
|
|
|
139
|
-
def initialize(uuid:, start_time:, end_time:, duration_ms:, query:, session_id:, client_interface:, error:, stats:,
|
|
142
|
+
def initialize(uuid:, start_time:, end_time:, duration_ms:, query:, session_id:, client_interface:, error:, stats:, visible:, requested_by:, user_agent:,
|
|
143
|
+
threads: nil, fingerprint: nil, session_catalog: nil, session_schema: nil, percentage: nil, rows_processed: nil, total_rows: nil)
|
|
140
144
|
@uuid = uuid
|
|
141
145
|
@start_time = start_time
|
|
142
146
|
@end_time = end_time
|
|
@@ -146,12 +150,20 @@ module Altertable
|
|
|
146
150
|
@client_interface = client_interface
|
|
147
151
|
@error = error
|
|
148
152
|
@stats = stats
|
|
149
|
-
@progress = progress
|
|
150
153
|
@visible = visible
|
|
151
154
|
@requested_by = requested_by
|
|
152
155
|
@user_agent = user_agent
|
|
156
|
+
@threads = threads
|
|
157
|
+
@fingerprint = fingerprint
|
|
158
|
+
@session_catalog = session_catalog
|
|
159
|
+
@session_schema = session_schema
|
|
160
|
+
@percentage = percentage
|
|
161
|
+
@rows_processed = rows_processed
|
|
162
|
+
@total_rows = total_rows
|
|
153
163
|
end
|
|
154
|
-
|
|
164
|
+
|
|
165
|
+
def progress = @percentage && QueryProgress.new(percentage: @percentage.to_f, rows_processed: @rows_processed, total_rows: @total_rows)
|
|
166
|
+
|
|
155
167
|
def self.from_h(h)
|
|
156
168
|
new(
|
|
157
169
|
uuid: h["uuid"],
|
|
@@ -163,10 +175,16 @@ module Altertable
|
|
|
163
175
|
client_interface: h["client_interface"],
|
|
164
176
|
error: h["error"],
|
|
165
177
|
stats: h["stats"],
|
|
166
|
-
progress: h["progress"],
|
|
167
178
|
visible: h["visible"],
|
|
168
179
|
requested_by: h["requested_by"],
|
|
169
|
-
user_agent: h["user_agent"]
|
|
180
|
+
user_agent: h["user_agent"],
|
|
181
|
+
threads: h["threads"],
|
|
182
|
+
fingerprint: h["fingerprint"],
|
|
183
|
+
session_catalog: h["session_catalog"],
|
|
184
|
+
session_schema: h["session_schema"],
|
|
185
|
+
percentage: h["percentage"],
|
|
186
|
+
rows_processed: h["rows_processed"],
|
|
187
|
+
total_rows: h["total_rows"]
|
|
170
188
|
)
|
|
171
189
|
end
|
|
172
190
|
end
|
|
@@ -197,13 +197,38 @@ module Altertable
|
|
|
197
197
|
end
|
|
198
198
|
def request(method, path, body: nil, query: nil, headers: {}); end
|
|
199
199
|
|
|
200
|
-
sig { params(resp: ::Altertable::Lakehouse::Adapters::Response,
|
|
201
|
-
def handle_stream_response(resp,
|
|
200
|
+
sig { params(resp: ::Altertable::Lakehouse::Adapters::Response, stream: ::Altertable::Lakehouse::NdjsonStream).void }
|
|
201
|
+
def handle_stream_response(resp, stream); end
|
|
202
|
+
|
|
203
|
+
sig { params(resp: ::Altertable::Lakehouse::Adapters::Response, stream: ::Altertable::Lakehouse::NdjsonStream).returns(String) }
|
|
204
|
+
def stream_error_body(resp, stream); end
|
|
202
205
|
|
|
203
206
|
sig { params(resp: ::Altertable::Lakehouse::Adapters::Response).returns(T.untyped) }
|
|
204
207
|
def handle_response(resp); end
|
|
205
208
|
end
|
|
206
209
|
|
|
210
|
+
class NdjsonStream
|
|
211
|
+
sig { params(on_value: T.proc.params(value: T.untyped).void).void }
|
|
212
|
+
def initialize(&on_value); end
|
|
213
|
+
|
|
214
|
+
sig { params(chunk: String, status: T.nilable(Integer)).void }
|
|
215
|
+
def write(chunk, status); end
|
|
216
|
+
|
|
217
|
+
sig { void }
|
|
218
|
+
def finish; end
|
|
219
|
+
|
|
220
|
+
sig { returns(String) }
|
|
221
|
+
def body; end
|
|
222
|
+
|
|
223
|
+
private
|
|
224
|
+
|
|
225
|
+
sig { void }
|
|
226
|
+
def emit_complete_lines; end
|
|
227
|
+
|
|
228
|
+
sig { params(line: String).void }
|
|
229
|
+
def emit(line); end
|
|
230
|
+
end
|
|
231
|
+
|
|
207
232
|
class ColumnDescriptor < Data
|
|
208
233
|
sig { returns(String) }
|
|
209
234
|
def name; end
|
|
@@ -411,6 +436,17 @@ module Altertable
|
|
|
411
436
|
def self.from_h(h); end
|
|
412
437
|
end
|
|
413
438
|
|
|
439
|
+
class QueryProgress < Data
|
|
440
|
+
sig { returns(Float) }
|
|
441
|
+
def percentage; end
|
|
442
|
+
|
|
443
|
+
sig { returns(Integer) }
|
|
444
|
+
def rows_processed; end
|
|
445
|
+
|
|
446
|
+
sig { returns(Integer) }
|
|
447
|
+
def total_rows; end
|
|
448
|
+
end
|
|
449
|
+
|
|
414
450
|
class QueryLogResponse < Request
|
|
415
451
|
sig { returns(String) }
|
|
416
452
|
def uuid; end
|
|
@@ -418,10 +454,10 @@ module Altertable
|
|
|
418
454
|
sig { returns(String) }
|
|
419
455
|
def start_time; end
|
|
420
456
|
|
|
421
|
-
sig { returns(String) }
|
|
457
|
+
sig { returns(T.nilable(String)) }
|
|
422
458
|
def end_time; end
|
|
423
459
|
|
|
424
|
-
sig { returns(Integer) }
|
|
460
|
+
sig { returns(T.nilable(Integer)) }
|
|
425
461
|
def duration_ms; end
|
|
426
462
|
|
|
427
463
|
sig { returns(String) }
|
|
@@ -439,36 +475,54 @@ module Altertable
|
|
|
439
475
|
sig { returns(T.untyped) }
|
|
440
476
|
def stats; end
|
|
441
477
|
|
|
442
|
-
sig { returns(T.untyped) }
|
|
443
|
-
def progress; end
|
|
444
|
-
|
|
445
478
|
sig { returns(T::Boolean) }
|
|
446
479
|
def visible; end
|
|
447
480
|
|
|
448
|
-
sig { returns(String) }
|
|
481
|
+
sig { returns(T.nilable(String)) }
|
|
449
482
|
def requested_by; end
|
|
450
483
|
|
|
451
|
-
sig { returns(String) }
|
|
484
|
+
sig { returns(T.nilable(String)) }
|
|
452
485
|
def user_agent; end
|
|
453
486
|
|
|
487
|
+
sig { returns(T.nilable(::Altertable::Lakehouse::Models::QueryProgress)) }
|
|
488
|
+
def progress; end
|
|
489
|
+
|
|
490
|
+
sig { returns(T.nilable(Integer)) }
|
|
491
|
+
def threads; end
|
|
492
|
+
|
|
493
|
+
sig { returns(T.nilable(String)) }
|
|
494
|
+
def fingerprint; end
|
|
495
|
+
|
|
496
|
+
sig { returns(T.nilable(String)) }
|
|
497
|
+
def session_catalog; end
|
|
498
|
+
|
|
499
|
+
sig { returns(T.nilable(String)) }
|
|
500
|
+
def session_schema; end
|
|
501
|
+
|
|
454
502
|
sig do
|
|
455
503
|
params(
|
|
456
504
|
uuid: String,
|
|
457
505
|
start_time: String,
|
|
458
|
-
end_time: String,
|
|
459
|
-
duration_ms: Integer,
|
|
506
|
+
end_time: T.nilable(String),
|
|
507
|
+
duration_ms: T.nilable(Integer),
|
|
460
508
|
query: String,
|
|
461
509
|
session_id: String,
|
|
462
510
|
client_interface: String,
|
|
463
511
|
error: T.untyped,
|
|
464
512
|
stats: T.untyped,
|
|
465
|
-
progress: T.untyped,
|
|
466
513
|
visible: T::Boolean,
|
|
467
|
-
requested_by: String,
|
|
468
|
-
user_agent: String
|
|
514
|
+
requested_by: T.nilable(String),
|
|
515
|
+
user_agent: T.nilable(String),
|
|
516
|
+
threads: T.nilable(Integer),
|
|
517
|
+
fingerprint: T.nilable(String),
|
|
518
|
+
session_catalog: T.nilable(String),
|
|
519
|
+
session_schema: T.nilable(String),
|
|
520
|
+
percentage: T.nilable(Numeric),
|
|
521
|
+
rows_processed: T.nilable(Integer),
|
|
522
|
+
total_rows: T.nilable(Integer)
|
|
469
523
|
).void
|
|
470
524
|
end
|
|
471
|
-
def initialize(uuid:, start_time:, end_time:, duration_ms:, query:, session_id:, client_interface:, error:, stats:,
|
|
525
|
+
def initialize(uuid:, start_time:, end_time:, duration_ms:, query:, session_id:, client_interface:, error:, stats:, visible:, requested_by:, user_agent:, threads: nil, fingerprint: nil, session_catalog: nil, session_schema: nil, percentage: nil, rows_processed: nil, total_rows: nil); end
|
|
472
526
|
|
|
473
527
|
sig { params(h: T::Hash[String, T.untyped]).returns(::Altertable::Lakehouse::Models::QueryLogResponse) }
|
|
474
528
|
def self.from_h(h); end
|
|
@@ -829,6 +883,17 @@ module Altertable
|
|
|
829
883
|
|
|
830
884
|
private
|
|
831
885
|
|
|
886
|
+
sig do
|
|
887
|
+
params(
|
|
888
|
+
client: T.untyped,
|
|
889
|
+
path: String,
|
|
890
|
+
body: T.nilable(String),
|
|
891
|
+
params: T::Hash[T.any(Symbol, String), T.untyped],
|
|
892
|
+
block: T.proc.params(arg0: String, arg1: Integer).void
|
|
893
|
+
).returns(::Altertable::Lakehouse::Adapters::Response)
|
|
894
|
+
end
|
|
895
|
+
def stream_post(client, path, body:, params:, &block); end
|
|
896
|
+
|
|
832
897
|
sig { params(resp: T.untyped).returns(::Altertable::Lakehouse::Adapters::Response) }
|
|
833
898
|
def wrap_response(resp); end
|
|
834
899
|
end
|
data/rbi/todo.rbi
CHANGED
|
@@ -99,10 +99,27 @@ module Altertable
|
|
|
99
99
|
?query: ::Hash[Symbol | String, untyped]?,
|
|
100
100
|
?headers: ::Hash[String, String]
|
|
101
101
|
) -> untyped
|
|
102
|
-
def handle_stream_response: (Adapters::Response resp,
|
|
102
|
+
def handle_stream_response: (Adapters::Response resp, NdjsonStream stream) -> void
|
|
103
|
+
def stream_error_body: (Adapters::Response resp, NdjsonStream stream) -> String
|
|
103
104
|
def handle_response: (Adapters::Response resp) -> untyped
|
|
104
105
|
end
|
|
105
106
|
|
|
107
|
+
class NdjsonStream
|
|
108
|
+
@on_value: ^(untyped value) -> void
|
|
109
|
+
@buffer: String
|
|
110
|
+
@streaming: bool
|
|
111
|
+
|
|
112
|
+
def initialize: () { (untyped value) -> void } -> void
|
|
113
|
+
def write: (String chunk, Integer? status) -> void
|
|
114
|
+
def finish: () -> void
|
|
115
|
+
def body: () -> String
|
|
116
|
+
|
|
117
|
+
private
|
|
118
|
+
|
|
119
|
+
def emit_complete_lines: () -> void
|
|
120
|
+
def emit: (String line) -> void
|
|
121
|
+
end
|
|
122
|
+
|
|
106
123
|
class ColumnDescriptor < ::Data
|
|
107
124
|
attr_reader name: String
|
|
108
125
|
attr_reader type: String
|
|
@@ -88,35 +88,55 @@ module Altertable
|
|
|
88
88
|
def self.from_h: (::Hash[String, untyped] h) -> ValidateResponse
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
+
class QueryProgress < ::Data
|
|
92
|
+
attr_reader percentage: Float
|
|
93
|
+
attr_reader rows_processed: Integer
|
|
94
|
+
attr_reader total_rows: Integer
|
|
95
|
+
|
|
96
|
+
def self.new: (percentage: Float, rows_processed: Integer, total_rows: Integer) -> instance
|
|
97
|
+
| (Float percentage, Integer rows_processed, Integer total_rows) -> instance
|
|
98
|
+
def to_h: () -> { percentage: Float, rows_processed: Integer, total_rows: Integer }
|
|
99
|
+
end
|
|
100
|
+
|
|
91
101
|
class QueryLogResponse < Request
|
|
92
102
|
attr_reader uuid: String
|
|
93
103
|
attr_reader start_time: String
|
|
94
|
-
attr_reader end_time: String
|
|
95
|
-
attr_reader duration_ms: Integer
|
|
104
|
+
attr_reader end_time: String?
|
|
105
|
+
attr_reader duration_ms: Integer?
|
|
96
106
|
attr_reader query: String
|
|
97
107
|
attr_reader session_id: String
|
|
98
108
|
attr_reader client_interface: String
|
|
99
109
|
attr_reader error: untyped
|
|
100
110
|
attr_reader stats: untyped
|
|
101
|
-
|
|
111
|
+
def progress: () -> QueryProgress?
|
|
102
112
|
attr_reader visible: bool
|
|
103
|
-
attr_reader requested_by: String
|
|
104
|
-
attr_reader user_agent: String
|
|
113
|
+
attr_reader requested_by: String?
|
|
114
|
+
attr_reader user_agent: String?
|
|
115
|
+
attr_reader threads: Integer?
|
|
116
|
+
attr_reader fingerprint: String?
|
|
117
|
+
attr_reader session_catalog: String?
|
|
118
|
+
attr_reader session_schema: String?
|
|
105
119
|
|
|
106
120
|
def initialize: (
|
|
107
121
|
uuid: String,
|
|
108
122
|
start_time: String,
|
|
109
|
-
end_time: String
|
|
110
|
-
duration_ms: Integer
|
|
123
|
+
end_time: String?,
|
|
124
|
+
duration_ms: Integer?,
|
|
111
125
|
query: String,
|
|
112
126
|
session_id: String,
|
|
113
127
|
client_interface: String,
|
|
114
128
|
error: untyped,
|
|
115
129
|
stats: untyped,
|
|
116
|
-
progress: untyped,
|
|
117
130
|
visible: bool,
|
|
118
|
-
requested_by: String
|
|
119
|
-
user_agent: String
|
|
131
|
+
requested_by: String?,
|
|
132
|
+
user_agent: String?,
|
|
133
|
+
?threads: Integer?,
|
|
134
|
+
?fingerprint: String?,
|
|
135
|
+
?session_catalog: String?,
|
|
136
|
+
?session_schema: String?,
|
|
137
|
+
?percentage: Numeric?,
|
|
138
|
+
?rows_processed: Integer?,
|
|
139
|
+
?total_rows: Integer?
|
|
120
140
|
) -> void
|
|
121
141
|
|
|
122
142
|
def self.from_h: (::Hash[String, untyped] h) -> QueryLogResponse
|