td 0.10.60 → 0.10.61

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.
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ == 2012-11-19 version 0.10.61
2
+
3
+ * Add --auto-create-table option to table:import subcommand. issue #9
4
+
5
+
1
6
  == 2012-11-16 version 0.10.60
2
7
 
3
8
  * td-client v0.8.37
@@ -25,6 +25,7 @@ module Command
25
25
 
26
26
  format = 'apache'
27
27
  time_key = 'time'
28
+ auto_create = false
28
29
 
29
30
  op.on('--format FORMAT', "file format (default: #{format})") {|s|
30
31
  format = s
@@ -50,10 +51,31 @@ module Command
50
51
  time_key = s
51
52
  }
52
53
 
54
+ op.on('--auto-create-table', "Create table and database if doesn't exist", TrueClass) { |b|
55
+ auto_create = b
56
+ }
57
+
53
58
  db_name, table_name, *paths = op.cmd_parse
54
59
 
55
60
  client = get_client
56
61
 
62
+ if auto_create
63
+ # Merge with db_create and table_create after refactoring
64
+ API.validate_database_name(db_name)
65
+ begin
66
+ client.create_database(db_name)
67
+ $stderr.puts "Database '#{db_name}' is created."
68
+ rescue AlreadyExistsError
69
+ end
70
+
71
+ API.validate_table_name(table_name)
72
+ begin
73
+ client.create_log_table(db_name, table_name)
74
+ $stderr.puts "Table '#{db_name}.#{table_name}' is created."
75
+ rescue AlreadyExistsError
76
+ end
77
+ end
78
+
57
79
  case format
58
80
  when 'json', 'msgpack'
59
81
  #unless time_key
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
 
3
- VERSION = '0.10.60'
3
+ VERSION = '0.10.61'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.60
4
+ version: 0.10.61
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-16 00:00:00.000000000 Z
12
+ date: 2012-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 1.8.24
171
+ rubygems_version: 1.8.23
172
172
  signing_key:
173
173
  specification_version: 3
174
174
  summary: CLI to manage data on Treasure Data, the Hadoop-based cloud data warehousing