td 0.16.3 → 0.16.4

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
- SHA256:
3
- metadata.gz: 07bd70e5cee714b760756d94558404b9ecc4598c9c9c5a16794f4e15cb61a8a5
4
- data.tar.gz: ddc1af1f1076065a2e71e7f52b0efb7494cd1c85d3262bcafee94224c039821c
2
+ SHA1:
3
+ metadata.gz: 2f0c51098af9b5cb3c28528a4d8ec826f5e0fef8
4
+ data.tar.gz: 707683b4efae2ff6541e9f6327002cc3c55b83d1
5
5
  SHA512:
6
- metadata.gz: 93357bcda065b255b1e8d4f2e1318c05f5a00981a85fae7bfaf6c2c80cc9e81e55def7153323a7e2376ea5faff67273ff4e3bf24bdd2e71d7d5d0852989ecf2b
7
- data.tar.gz: b8ad6a5ad0c55fe8b06edb55468b58c1f0ef2d5c59ee1f97f0e25b40cf4670b43f41574303dea9a065388f7ad8f2c258de0a605137ce2b84ca2989496a1ad7f7
6
+ metadata.gz: 22e82bcaaaa048e1740059f32852aa1bf1908ad2ee655b7e497f5a58083e317bc713e9db2ca31758d2b243ee49ef5c1ab3c83b4e700f36910fc354a8f20f034f
7
+ data.tar.gz: '08888013e2bad1e89cd0f35593efe764bf65191d0f8f1e0ed2a3199635dea8e014ca23ba3540a24a7cc5e4851462e5ea163749f7893eed1d112251e8359caaef'
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ == 2018-12-03 version 0.16.4
2
+
3
+ * Support engine versions for query and schedule (EXPERIMENTAL) #216
4
+
1
5
  == 2018-11-21 version 0.16.3
2
6
 
3
7
  * Support running status of job for td export:result command #207
@@ -21,6 +21,7 @@ module Command
21
21
  exclude = false
22
22
  pool_name = nil
23
23
  domain_key = nil
24
+ engine_version = nil
24
25
 
25
26
  op.on('-d', '--database DB_NAME', 'use the database (required)') {|s|
26
27
  db_name = s
@@ -90,6 +91,9 @@ module Command
90
91
  op.on('--domain-key DOMAIN_KEY', 'optional user-provided unique ID. You can include this ID with your `create` request to ensure idempotence') {|s|
91
92
  domain_key = s
92
93
  }
94
+ op.on('--engine-version ENGINE_VERSION', 'EXPERIMENTAL: specify query engine version by name') {|s|
95
+ engine_version = s
96
+ }
93
97
 
94
98
  sql = op.cmd_parse
95
99
 
@@ -140,6 +144,7 @@ module Command
140
144
  opts['type'] = type if type
141
145
  opts['pool_name'] = pool_name if pool_name
142
146
  opts['domain_key'] = domain_key if domain_key
147
+ opts['engine_version'] = engine_version if engine_version
143
148
  job = client.query(db_name, sql, result_url, priority, retry_limit, opts)
144
149
 
145
150
  $stdout.puts "Job #{job.job_id} is queued."
@@ -39,6 +39,7 @@ module Command
39
39
  query = nil
40
40
  retry_limit = nil
41
41
  type = nil
42
+ engine_version = nil
42
43
 
43
44
  op.on('-d', '--database DB_NAME', 'use the database (required)') {|s|
44
45
  db_name = s
@@ -79,6 +80,9 @@ module Command
79
80
  op.on('-T', '--type TYPE', 'set query type (hive)') {|s|
80
81
  type = s
81
82
  }
83
+ op.on('--engine-version ENGINE_VERSION', 'EXPERIMENTAL: specify query engine version by name') {|s|
84
+ engine_version = s
85
+ }
82
86
 
83
87
  name, cron, sql = op.cmd_parse
84
88
 
@@ -109,7 +113,7 @@ module Command
109
113
  get_database(client, db_name)
110
114
 
111
115
  begin
112
- first_time = client.create_schedule(name, :cron=>cron, :query=>sql, :database=>db_name, :result=>result_url, :timezone=>timezone, :delay=>delay, :priority=>priority, :retry_limit=>retry_limit, :type=>type)
116
+ first_time = client.create_schedule(name, :cron=>cron, :query=>sql, :database=>db_name, :result=>result_url, :timezone=>timezone, :delay=>delay, :priority=>priority, :retry_limit=>retry_limit, :type=>type, :engine_version=>engine_version)
113
117
  rescue AlreadyExistsError
114
118
  cmd_debug_error $!
115
119
  $stderr.puts "Schedule '#{name}' already exists."
@@ -153,6 +157,7 @@ module Command
153
157
  priority = nil
154
158
  retry_limit = nil
155
159
  type = nil
160
+ engine_version = nil
156
161
 
157
162
  op.on('-n', '--newname NAME', 'change the schedule\'s name') {|n|
158
163
  newname = n
@@ -193,6 +198,9 @@ module Command
193
198
  op.on('-T', '--type TYPE', 'set query type (hive)') {|s|
194
199
  type = s
195
200
  }
201
+ op.on('--engine-version ENGINE_VERSION', 'EXPERIMENTAL: specify query engine version by name') {|s|
202
+ engine_version = s
203
+ }
196
204
 
197
205
  curname = op.cmd_parse
198
206
 
@@ -207,6 +215,7 @@ module Command
207
215
  params['priority'] = priority.to_s if priority
208
216
  params['retry_limit'] = retry_limit.to_s if retry_limit
209
217
  params['type'] = type.to_s if type
218
+ params['engine_version'] = engine_version if engine_version
210
219
 
211
220
  if params.empty?
212
221
  $stderr.puts op.to_s
@@ -1,3 +1,3 @@
1
1
  module TreasureData
2
- TOOLBELT_VERSION = '0.16.3'
2
+ TOOLBELT_VERSION = '0.16.4'
3
3
  end
@@ -102,5 +102,15 @@ module TreasureData::Command
102
102
  end
103
103
  end
104
104
  end
105
+
106
+ describe 'engine version' do
107
+ it 'accepts --engine-version' do
108
+ expect(client).to receive(:query).
109
+ with("sample_datasets", "SELECT 1;", nil, nil, nil, {"engine_version"=>"stable"}).
110
+ and_return(job)
111
+ op = List::CommandParser.new("query", %w[query], %w[], nil, ['--engine-version=stable', '-dsample_datasets', 'SELECT 1;'], false)
112
+ command.query(op)
113
+ end
114
+ end
105
115
  end
106
116
  end
@@ -27,6 +27,59 @@ module TreasureData::Command
27
27
  allow(command).to receive(:get_client).and_return(client)
28
28
  end
29
29
 
30
+ describe 'sched_create' do
31
+ before do
32
+ expect(client).to receive(:database).with('sample_datasets')
33
+ end
34
+
35
+ describe 'engine version' do
36
+ let(:op) {
37
+ List::CommandParser.new(
38
+ 'sched:create',
39
+ %w[name cron sql],
40
+ %w[],
41
+ false,
42
+ ['--engine-version=stable', '-dsample_datasets', 'sched1', '0 * * * *', 'select count(*) from table1'],
43
+ false
44
+ )
45
+ }
46
+
47
+ it 'accepts --engine-version' do
48
+ expect(client).to receive(:create_schedule).
49
+ with(
50
+ "sched1",
51
+ {
52
+ cron: '0 * * * *',
53
+ query: 'select count(*) from table1',
54
+ database: 'sample_datasets',
55
+ result: nil,
56
+ timezone: nil,
57
+ delay: 0,
58
+ priority: nil,
59
+ retry_limit: nil,
60
+ type: nil,
61
+ engine_version: "stable"
62
+ }
63
+ ).
64
+ and_return(nil)
65
+ command.sched_create(op)
66
+ end
67
+ end
68
+ end
69
+
70
+ describe 'sched_update' do
71
+ describe 'engine version' do
72
+ let(:op) { List::CommandParser.new('sched:update', %w[name], %w[], false, ['--engine-version=stable', 'old_name'], false) }
73
+
74
+ it 'accepts --engine-version' do
75
+ expect(client).to receive(:update_schedule).
76
+ with("old_name", {"engine_version"=>"stable"}).
77
+ and_return(nil)
78
+ command.sched_update(op)
79
+ end
80
+ end
81
+ end
82
+
30
83
  describe 'sched_history' do
31
84
  before do
32
85
  allow(client).to receive(:history).and_return(history)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.3
4
+ version: 0.16.4
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: 2018-11-21 00:00:00.000000000 Z
11
+ date: 2018-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -309,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
309
  version: '0'
310
310
  requirements: []
311
311
  rubyforge_project:
312
- rubygems_version: 2.7.6
312
+ rubygems_version: 2.6.14.1
313
313
  signing_key:
314
314
  specification_version: 4
315
315
  summary: CLI to manage data on Treasure Data, the Hadoop-based cloud data warehousing