td-client 2.0.0 → 3.0.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/lib/td/client/api.rb +1 -3
- data/lib/td/client/version.rb +1 -1
- data/lib/td/client.rb +1 -12
- data/spec/td/client/spec_resources.rb +1 -2
- metadata +22 -11
- data/lib/td/client/api/partial_delete.rb +0 -27
- data/spec/td/client/partial_delete_api_spec.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a815afcaf4e457f68fa81175e3359b29b4054454d817cafdccc12d2921d88bb6
|
4
|
+
data.tar.gz: 49b578a5af81fa21262ebc1c0a5974ac8dab57901513318f408afeeeeb58f082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2183a16af8bca14b53503444322b4fea765c1a9ef374c15a4549f349fcd3874f234df85202cef2c7e428d2e6481c570e3589a34116935da71a8bcf853f8dabc
|
7
|
+
data.tar.gz: b0290f67090890cb71579bf2dc58a4aa7cd76448e8847fe6a3514e4bd6b871d3528625559856640155c980d44433183ab5c08985b36725eb39ef5593633afc67
|
data/lib/td/client/api.rb
CHANGED
@@ -7,7 +7,6 @@ require 'td/client/api/database'
|
|
7
7
|
require 'td/client/api/export'
|
8
8
|
require 'td/client/api/import'
|
9
9
|
require 'td/client/api/job'
|
10
|
-
require 'td/client/api/partial_delete'
|
11
10
|
require 'td/client/api/result'
|
12
11
|
require 'td/client/api/schedule'
|
13
12
|
require 'td/client/api/server_status'
|
@@ -27,7 +26,6 @@ class API
|
|
27
26
|
include API::Export
|
28
27
|
include API::Import
|
29
28
|
include API::Job
|
30
|
-
include API::PartialDelete
|
31
29
|
include API::Result
|
32
30
|
include API::Schedule
|
33
31
|
include API::ServerStatus
|
@@ -527,7 +525,7 @@ private
|
|
527
525
|
client.ssl_config.options |= OpenSSL::SSL::OP_NO_SSLv3
|
528
526
|
end
|
529
527
|
|
530
|
-
# allow users to use their own custom ca
|
528
|
+
# allow users to use their own custom ca
|
531
529
|
# or disable verification
|
532
530
|
if @verify == false
|
533
531
|
client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
data/lib/td/client/version.rb
CHANGED
data/lib/td/client.rb
CHANGED
@@ -183,7 +183,7 @@ class Client
|
|
183
183
|
def query(db_name, q, result_url=nil, priority=nil, retry_limit=nil, opts={})
|
184
184
|
# for compatibility, assume type is hive unless specifically specified
|
185
185
|
type = opts[:type] || opts['type'] || :hive
|
186
|
-
raise ArgumentError, "The specified query type is not supported: #{type}" unless [:hive, :pig, :impala, :presto].include?(type)
|
186
|
+
raise ArgumentError, "The specified query type is not supported: #{type}" unless [:hive, :pig, :impala, :presto, :trino].include?(type)
|
187
187
|
job_id = @api.query(q, type, db_name, result_url, priority, retry_limit, opts)
|
188
188
|
Job.new(self, job_id, type, q)
|
189
189
|
end
|
@@ -277,17 +277,6 @@ class Client
|
|
277
277
|
Job.new(self, job_id, :result_export, nil)
|
278
278
|
end
|
279
279
|
|
280
|
-
# @param [String] db_name
|
281
|
-
# @param [String] table_name
|
282
|
-
# @param [Fixnum] to
|
283
|
-
# @param [Fixnum] from
|
284
|
-
# @param [Hash] opts
|
285
|
-
# @return [Job]
|
286
|
-
def partial_delete(db_name, table_name, to, from, opts={})
|
287
|
-
job_id = @api.partial_delete(db_name, table_name, to, from, opts)
|
288
|
-
Job.new(self, job_id, :partialdelete, nil)
|
289
|
-
end
|
290
|
-
|
291
280
|
# @param [String] name
|
292
281
|
# @param [String] database
|
293
282
|
# @param [String] table
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Treasure Data, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '3.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: coveralls_reborn
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
@@ -78,28 +78,42 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 3.25.1
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 3.25.1
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: mutex_m
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
104
|
name: simplecov
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
92
106
|
requirements:
|
93
107
|
- - ">="
|
94
108
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.
|
109
|
+
version: 0.21.2
|
96
110
|
type: :development
|
97
111
|
prerelease: false
|
98
112
|
version_requirements: !ruby/object:Gem::Requirement
|
99
113
|
requirements:
|
100
114
|
- - ">="
|
101
115
|
- !ruby/object:Gem::Version
|
102
|
-
version: 0.
|
116
|
+
version: 0.21.2
|
103
117
|
- !ruby/object:Gem::Dependency
|
104
118
|
name: rake
|
105
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,7 +173,6 @@ files:
|
|
159
173
|
- lib/td/client/api/export.rb
|
160
174
|
- lib/td/client/api/import.rb
|
161
175
|
- lib/td/client/api/job.rb
|
162
|
-
- lib/td/client/api/partial_delete.rb
|
163
176
|
- lib/td/client/api/result.rb
|
164
177
|
- lib/td/client/api/schedule.rb
|
165
178
|
- lib/td/client/api/server_status.rb
|
@@ -184,7 +197,6 @@ files:
|
|
184
197
|
- spec/td/client/model_job_spec.rb
|
185
198
|
- spec/td/client/model_schedule_spec.rb
|
186
199
|
- spec/td/client/model_schema_spec.rb
|
187
|
-
- spec/td/client/partial_delete_api_spec.rb
|
188
200
|
- spec/td/client/result_api_spec.rb
|
189
201
|
- spec/td/client/sched_api_spec.rb
|
190
202
|
- spec/td/client/server_status_api_spec.rb
|
@@ -212,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
224
|
- !ruby/object:Gem::Version
|
213
225
|
version: '0'
|
214
226
|
requirements: []
|
215
|
-
rubygems_version: 3.
|
227
|
+
rubygems_version: 3.3.7
|
216
228
|
signing_key:
|
217
229
|
specification_version: 4
|
218
230
|
summary: Treasure Data API library for Ruby
|
@@ -230,7 +242,6 @@ test_files:
|
|
230
242
|
- spec/td/client/model_job_spec.rb
|
231
243
|
- spec/td/client/model_schedule_spec.rb
|
232
244
|
- spec/td/client/model_schema_spec.rb
|
233
|
-
- spec/td/client/partial_delete_api_spec.rb
|
234
245
|
- spec/td/client/result_api_spec.rb
|
235
246
|
- spec/td/client/sched_api_spec.rb
|
236
247
|
- spec/td/client/server_status_api_spec.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
class TreasureData::API
|
2
|
-
module PartialDelete
|
3
|
-
|
4
|
-
####
|
5
|
-
## Partial delete API
|
6
|
-
##
|
7
|
-
|
8
|
-
# @param [String] db
|
9
|
-
# @param [String] table
|
10
|
-
# @param [Fixnum] to
|
11
|
-
# @param [Fixnum] from
|
12
|
-
# @param [Hash] opts
|
13
|
-
# @return [String]
|
14
|
-
def partial_delete(db, table, to, from, opts={})
|
15
|
-
params = opts.dup
|
16
|
-
params['to'] = to.to_s
|
17
|
-
params['from'] = from.to_s
|
18
|
-
code, body, res = post("/v3/table/partialdelete/#{e db}/#{e table}", params)
|
19
|
-
if code != "200"
|
20
|
-
raise_error("Partial delete failed", res)
|
21
|
-
end
|
22
|
-
js = checked_json(body, %w[job_id])
|
23
|
-
return js['job_id'].to_s
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'td/client/spec_resources'
|
3
|
-
|
4
|
-
describe 'PartialDelete API' do
|
5
|
-
include_context 'spec symbols'
|
6
|
-
include_context 'common helper'
|
7
|
-
|
8
|
-
let :api do
|
9
|
-
API.new(nil)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe 'partialdelete' do
|
13
|
-
let :from do
|
14
|
-
0
|
15
|
-
end
|
16
|
-
|
17
|
-
let :to do
|
18
|
-
3600 * 10
|
19
|
-
end
|
20
|
-
|
21
|
-
let :from_to do
|
22
|
-
{'from' => from.to_s, 'to' => to.to_s}
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should partial_delete successfully' do
|
26
|
-
# TODO: Use correnty values
|
27
|
-
stub_api_request(:post, "/v3/table/partialdelete/#{e(db_name)}/#{e(table_name)}").with(:body => from_to).
|
28
|
-
to_return(:body => {'database' => db_name, 'table' => table_name, 'job_id' => '1'}.to_json)
|
29
|
-
|
30
|
-
expect(api.partial_delete(db_name, table_name, to, from)).to eq('1')
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should return 404 error with non exist database name' do
|
34
|
-
db = 'no_such_db'
|
35
|
-
err_msg = "Couldn't find UserDatabase with name = #{db}"
|
36
|
-
stub_api_request(:post, "/v3/table/partialdelete/#{e(db)}/#{e(table_name)}").with(:body => from_to).
|
37
|
-
to_return(:status => 404, :body => {'message' => err_msg}.to_json)
|
38
|
-
|
39
|
-
expect {
|
40
|
-
api.partial_delete(db, table_name, to, from)
|
41
|
-
}.to raise_error(TreasureData::APIError, /#{err_msg}/)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should return 404 error with non exist table name' do
|
45
|
-
table = 'no_such_table'
|
46
|
-
err_msg = "Unknown table: #{table}"
|
47
|
-
stub_api_request(:post, "/v3/table/partialdelete/#{e(db_name)}/#{e(table)}").with(:body => from_to).
|
48
|
-
to_return(:status => 404, :body => {'message' => err_msg}.to_json)
|
49
|
-
|
50
|
-
expect {
|
51
|
-
api.partial_delete(db_name, table, to, from)
|
52
|
-
}.to raise_error(TreasureData::APIError, /#{err_msg}/)
|
53
|
-
end
|
54
|
-
|
55
|
-
# TODO: Add from / to parameters spec
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|