embulk-output-bigobject 0.3.1 → 0.3.2

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
2
  SHA1:
3
- metadata.gz: c81e43cbcfc28f2cdc9d694f33d57053a792d078
4
- data.tar.gz: 49fe6120e1221be7faedb5d281ae969fe9f416e4
3
+ metadata.gz: 589f01425ae821d10c32d0c4eccbc87f74bed685
4
+ data.tar.gz: 66e3a2dac27b9d00a37462bd223a488cedda806e
5
5
  SHA512:
6
- metadata.gz: 30216e7a22db6754ba96481af984e03f240b28d8be931e86093cb1435a09e41fd889f2a6081ec5e58557118d5625d839348daf6c1e2acbfc84cc924e10159144
7
- data.tar.gz: e6c10e5720c8bc6e6bd80786a6063570d7637c658b7fec97833fffbff7c537d59b5d34e7e4fb6c9091c47c1caae9b801962c49e7ffc99c239f95beca94648504
6
+ metadata.gz: b2e32268ab187242cda5e2b69709904bed54fb7f810a9b444543187ef0198838f2341177f79a91f1fec8483daa09297e58b17ca461ab9bb7ef95d5dd75acecc9
7
+ data.tar.gz: 3454e8932ec72e60abac4372c01590624ec57ae17dd0e2f8a78c302d12feaa69ecc97eb1224e1846727a06e4f3d342ec4c6dbd4af1496dabd11a61e750aa9d0e
data/Rakefile CHANGED
@@ -1,3 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
3
  task default: :build
4
+
5
+ task :test do
6
+ sh "embulk run -l debug -L . config.yml"
7
+ end
@@ -1,8 +1,8 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-output-bigobject"
4
- spec.version = "0.3.1"
5
- spec.authors = ["cchuang"]
4
+ spec.version = "0.3.2"
5
+ spec.authors = ["Cheng-Ching Huang"]
6
6
  spec.summary = "Bigobject output plugin for Embulk"
7
7
  spec.description = "Dumps records to Bigobject."
8
8
  spec.email = ["cchuang.tw@gmail.com"]
@@ -44,7 +44,8 @@ module Embulk
44
44
  if response["Status"] == 0 then # the table exists
45
45
  Embulk.logger.debug { "#{response}" }
46
46
  elsif response["Status"] == -11 then # the table does not exist
47
- response = rest_exec(task['rest_uri'], "#{create_botable_stmt("#{task['table']}",schema, task['co_map'])}")
47
+ #response = rest_exec(task['rest_uri'], "#{create_botable_stmt("#{task['table']}",schema, task['co_map'])}")
48
+ response = rest_exec(task['rest_uri'], "#{create_botable_stmt("#{task['table']}",schema, task["column_options"])}")
48
49
  if response["Status"] != 0 then
49
50
  Embulk.logger.error { "#{response}" }
50
51
  raise "Create table #{task['table']} in BigObject Failed"
@@ -149,10 +150,17 @@ module Embulk
149
150
  end
150
151
 
151
152
  def self.create_botable_stmt(tbl,schema, cos)
152
- Embulk.logger.debug {"schema: #{schema}"}
153
- bo_table_schema = schema.map {|column| "#{column.name} #{to_bigobject_column_type(column.type.to_s, column.format.to_s, cos[column.name])}" }.join(',')
153
+ val_array = Array.new
154
+ schema.each do |c|
155
+ co = cos[c.index] || {}
156
+ Embulk.logger.debug {"#{c.index}, #{c.name}, #{co}"}
157
+ val_array.push "#{co["name"] || c.name} #{to_bigobject_column_type(c.type.to_s, c.format.to_s, co)}"
158
+ end
159
+ bo_table_schema = val_array.join(',')
160
+ Embulk.logger.debug {"schema (#{schema.class}): #{schema}"}
161
+ Embulk.logger.debug {"schema: #{bo_table_schema}"}
154
162
  keys = Array.new
155
- cos.each do |k, co|
163
+ cos.each do |co|
156
164
  keys.push co["name"] if co["is_key"]
157
165
  end
158
166
  if keys.length == 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-bigobject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
- - cchuang
7
+ - Cheng-Ching Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-06 00:00:00.000000000 Z
11
+ date: 2016-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client