td 0.11.8.1 → 0.11.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/lib/td/command/export.rb +15 -1
- data/lib/td/command/table.rb +0 -58
- data/lib/td/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3254397bd4682922aecaf0d08242c2219e16f76e
|
4
|
+
data.tar.gz: ac9686878f407ad6c950a9907f85b695ffadef04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 881fdc4e2dcdc2a72c545ff7520e88ed507a348932e58996058d865b9e070d59efbbf93ee7d13fe97ffe0f0af65a1047ae5644c1ed0ef8371f3ba2d7c44ab5f9
|
7
|
+
data.tar.gz: ee2a8080e1b490981a23dd2ce50314817c2abf1552cd8f09acf3d798485a5b8c872379eff7bda7edd3c84f126b7c410ad9df5fec063aa073230a3df46c9b7916
|
data/ChangeLog
CHANGED
data/lib/td/command/export.rb
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
|
2
2
|
module TreasureData
|
3
3
|
module Command
|
4
|
-
SUPPORTED_FORMATS = %W[json.gz line-json.gz]
|
4
|
+
SUPPORTED_FORMATS = %W[json.gz line-json.gz tsv.gz]
|
5
5
|
|
6
6
|
def table_export(op)
|
7
7
|
from = nil
|
8
8
|
to = nil
|
9
9
|
s3_bucket = nil
|
10
|
+
wait = false
|
10
11
|
aws_access_key_id = nil
|
11
12
|
aws_secret_access_key = nil
|
13
|
+
file_prefix = nil
|
12
14
|
file_format = "json.gz" # default
|
13
15
|
|
16
|
+
op.on('-w', '--wait', 'wait until the job is completed', TrueClass) {|b|
|
17
|
+
wait = b
|
18
|
+
}
|
14
19
|
op.on('-f', '--from TIME', 'export data which is newer than or same with the TIME') {|s|
|
15
20
|
from = export_parse_time(s)
|
16
21
|
}
|
@@ -20,6 +25,9 @@ module Command
|
|
20
25
|
op.on('-b', '--s3-bucket NAME', 'name of the destination S3 bucket (required)') {|s|
|
21
26
|
s3_bucket = s
|
22
27
|
}
|
28
|
+
op.on('-p', '--prefix PATH', 'path prefix of the file on S3') {|s|
|
29
|
+
file_prefix = s
|
30
|
+
}
|
23
31
|
op.on('-k', '--aws-key-id KEY_ID', 'AWS access key id to export data (required)') {|s|
|
24
32
|
aws_access_key_id = s
|
25
33
|
}
|
@@ -57,6 +65,7 @@ module Command
|
|
57
65
|
s3_opts = {}
|
58
66
|
s3_opts['from'] = from.to_s if from
|
59
67
|
s3_opts['to'] = to.to_s if to
|
68
|
+
s3_opts['file_prefix'] = file_prefix if file_prefix
|
60
69
|
s3_opts['file_format'] = file_format
|
61
70
|
s3_opts['bucket'] = s3_bucket
|
62
71
|
s3_opts['access_key_id'] = aws_access_key_id
|
@@ -66,6 +75,11 @@ module Command
|
|
66
75
|
|
67
76
|
$stderr.puts "Export job #{job.job_id} is queued."
|
68
77
|
$stderr.puts "Use '#{$prog} " + Config.cl_options_string + "job:show #{job.job_id}' to show the status."
|
78
|
+
|
79
|
+
if wait && !job.finished?
|
80
|
+
wait_job(job)
|
81
|
+
puts "Status : #{job.status}"
|
82
|
+
end
|
69
83
|
end
|
70
84
|
|
71
85
|
private
|
data/lib/td/command/table.rb
CHANGED
@@ -286,64 +286,6 @@ module Command
|
|
286
286
|
end
|
287
287
|
end
|
288
288
|
|
289
|
-
def table_export(op)
|
290
|
-
from = nil
|
291
|
-
to = nil
|
292
|
-
s3_bucket = nil
|
293
|
-
wait = false
|
294
|
-
|
295
|
-
## TODO
|
296
|
-
#op.on('-t', '--to TIME', 'end time of logs to get') {|s|
|
297
|
-
# if s.to_i.to_s == s
|
298
|
-
# to = s
|
299
|
-
# else
|
300
|
-
# require 'time'
|
301
|
-
# to = Time.parse(s).to_i
|
302
|
-
# end
|
303
|
-
#}
|
304
|
-
#op.on('-f', '--from TIME', 'start time of logs to get') {|s|
|
305
|
-
# if s.to_i.to_s == s
|
306
|
-
# from = s
|
307
|
-
# else
|
308
|
-
# require 'time'
|
309
|
-
# from = Time.parse(s).to_i
|
310
|
-
# end
|
311
|
-
#}
|
312
|
-
op.on('-w', '--wait', 'wait until the job is completed', TrueClass) {|b|
|
313
|
-
wait = b
|
314
|
-
}
|
315
|
-
op.on('--s3-bucket NAME', 'name of the s3 bucket to output') {|s|
|
316
|
-
s3_bucket = s
|
317
|
-
}
|
318
|
-
|
319
|
-
db_name, table_name = op.cmd_parse
|
320
|
-
|
321
|
-
unless s3_bucket
|
322
|
-
$stderr.puts "--s3-bucket NAME option is required"
|
323
|
-
exit 1
|
324
|
-
end
|
325
|
-
|
326
|
-
client = get_client
|
327
|
-
|
328
|
-
table = get_table(client, db_name, table_name)
|
329
|
-
|
330
|
-
opts = {}
|
331
|
-
opts['s3_bucket'] = s3_bucket
|
332
|
-
opts['s3_file_format'] ='json.gz'
|
333
|
-
opts['from'] = from.to_s if from
|
334
|
-
opts['to'] = to.to_s if to
|
335
|
-
|
336
|
-
job = table.export('s3', opts)
|
337
|
-
|
338
|
-
$stderr.puts "Export job #{job.job_id} is queued."
|
339
|
-
$stderr.puts "Use '#{$prog} " + Config.cl_options_string + "job:show #{job.job_id}' to show the status."
|
340
|
-
|
341
|
-
if wait && !job.finished?
|
342
|
-
wait_job(job)
|
343
|
-
puts "Status : #{job.status}"
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
289
|
def table_partial_delete(op)
|
348
290
|
from = nil
|
349
291
|
to = nil
|
data/lib/td/version.rb
CHANGED
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.11.8.
|
4
|
+
version: 0.11.8.2
|
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: 2015-03-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|