embulk-output-bigquery 0.3.0.pre6 → 0.3.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/CHANGELOG.md +1 -1
- data/README.md +3 -3
- data/embulk-output-bigquery.gemspec +1 -1
- data/lib/embulk/output/bigquery.rb +3 -3
- data/lib/embulk/output/bigquery/bigquery_client.rb +1 -1
- data/test/helper.rb +1 -0
- data/test/test_bigquery_client.rb +7 -5
- data/test/test_example.rb +5 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06dd5ff0d084e46e4e6d3c5b4428b5a0500a69e1
|
4
|
+
data.tar.gz: 974f71b43c073e5f324e27232cac48100ce5c9bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55fc22719752768be1f4a45b1e7a4c011f01a75dfd68840f1deadbed8e2aa4cd88071ddbeaf9e3ea63ac0cdbe0b875756a51f9ef024c08f5722545833da6b5e3
|
7
|
+
data.tar.gz: a5d30638f60ad162950219fbc58a525dd11662cc86b05d94cb02b8fd7dbf089a644a20f5a35a06e51e85f8685f5a1adb1fb07e24c46cc7d240f7453355c77953
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -68,7 +68,7 @@ Options for intermediate local files
|
|
68
68
|
| sequence_format | string | optional | .%d.%d | Sequence format for pid, thread id |
|
69
69
|
| file_ext | string | optional | | The file extension of local files such as ".csv.gz" ".json.gz". Default automatically generates from `source_format` and `compression`|
|
70
70
|
| skip_file_generation | boolean | optional | | Load already generated local files into BigQuery if available. Specify correct path_prefix and file_ext. |
|
71
|
-
| delete_from_local_when_job_end | boolean | optional |
|
71
|
+
| delete_from_local_when_job_end | boolean | optional | true | If set to true, delete generate local files when job is end |
|
72
72
|
| compression | string | optional | "NONE" | Compression of local files (`GZIP` or `NONE`) |
|
73
73
|
|
74
74
|
`source_format` is also used to determine formatter (csv or jsonl).
|
@@ -354,8 +354,8 @@ To run tests which actually connects to BigQuery such as test/test\_bigquery\_cl
|
|
354
354
|
prepare a json\_keyfile at example/your-project-000.json, then
|
355
355
|
|
356
356
|
```
|
357
|
-
$
|
358
|
-
$
|
357
|
+
$ bundle exec ruby test/test_bigquery_client.rb
|
358
|
+
$ bundle exec ruby test/test_example.rb
|
359
359
|
```
|
360
360
|
|
361
361
|
### Release gem:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "embulk-output-bigquery"
|
3
|
-
spec.version = "0.3.0
|
3
|
+
spec.version = "0.3.0"
|
4
4
|
spec.authors = ["Satoshi Akama", "Naotoshi Seo"]
|
5
5
|
spec.summary = "Google BigQuery output plugin for Embulk"
|
6
6
|
spec.description = "Embulk plugin that insert records to Google BigQuery."
|
@@ -12,7 +12,7 @@ module Embulk
|
|
12
12
|
|
13
13
|
class Error < StandardError; end
|
14
14
|
|
15
|
-
# To support configuration like below as org.embulk.spi.unit.
|
15
|
+
# To support configuration like below as org.embulk.spi.unit.LocalFile
|
16
16
|
#
|
17
17
|
# json_keyfile:
|
18
18
|
# content: |
|
@@ -321,13 +321,13 @@ module Embulk
|
|
321
321
|
ensure
|
322
322
|
if task['delete_from_local_when_job_end']
|
323
323
|
paths.each do |path|
|
324
|
-
Embulk.logger.info { "delete #{path}" }
|
324
|
+
Embulk.logger.info { "embulk-output-bigquery: delete #{path}" }
|
325
325
|
File.unlink(path) rescue nil
|
326
326
|
end
|
327
327
|
else
|
328
328
|
paths.each do |path|
|
329
329
|
if File.exist?(path)
|
330
|
-
Embulk.logger.info { "#{path}
|
330
|
+
Embulk.logger.info { "embulk-output-bigquery: keep #{path}" }
|
331
331
|
end
|
332
332
|
end
|
333
333
|
end
|
@@ -272,7 +272,7 @@ module Embulk
|
|
272
272
|
"embulk-output-bigquery: get_job(#{@project}, #{job_id}), " \
|
273
273
|
"errors:#{_errors.map(&:to_h)}"
|
274
274
|
}
|
275
|
-
raise Error, "failed during waiting a job, errors:#{_errors.map(&:to_h)}"
|
275
|
+
raise Error, "failed during waiting a #{kind} job, errors:#{_errors.map(&:to_h)}"
|
276
276
|
end
|
277
277
|
|
278
278
|
_response
|
data/test/helper.rb
CHANGED
@@ -11,3 +11,4 @@ Embulk.logger = Embulk::Logger.new('/dev/null')
|
|
11
11
|
APP_ROOT = File.expand_path('../', __dir__)
|
12
12
|
EXAMPLE_ROOT = File.expand_path('../example', __dir__)
|
13
13
|
TEST_ROOT = File.expand_path(File.dirname(__FILE__))
|
14
|
+
JSON_KEYFILE = File.join(EXAMPLE_ROOT, 'your-project-000.json')
|
@@ -2,10 +2,12 @@ require_relative './helper'
|
|
2
2
|
require 'embulk/output/bigquery/bigquery_client'
|
3
3
|
require 'csv'
|
4
4
|
|
5
|
-
# 1. Prepare /
|
6
|
-
# 2.
|
5
|
+
# 1. Prepare example/your-project-000.json
|
6
|
+
# 2. bunlde exec ruby test/test_bigquery_client.rb
|
7
7
|
|
8
|
-
|
8
|
+
unless File.exist?(JSON_KEYFILE)
|
9
|
+
puts "#{JSON_KEYFILE} is not found. Skip test/test_bigquery_client.rb"
|
10
|
+
else
|
9
11
|
module Embulk
|
10
12
|
class Output::Bigquery
|
11
13
|
class TestBigqueryClient < Test::Unit::TestCase
|
@@ -26,11 +28,11 @@ if ENV['CONNECT']
|
|
26
28
|
|
27
29
|
def least_task
|
28
30
|
{
|
29
|
-
'project' => JSON.parse(File.read(
|
31
|
+
'project' => JSON.parse(File.read(JSON_KEYFILE))['project_id'],
|
30
32
|
'dataset' => 'your_dataset_name',
|
31
33
|
'table' => 'your_table_name',
|
32
34
|
'auth_method' => 'json_key',
|
33
|
-
'json_keyfile' =>
|
35
|
+
'json_keyfile' => JSON_KEYFILE,
|
34
36
|
'retries' => 3,
|
35
37
|
'timeout_sec' => 300,
|
36
38
|
'open_timeout_sec' => 300,
|
data/test/test_example.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require_relative './helper'
|
2
2
|
|
3
|
-
# 1. Prepare /
|
3
|
+
# 1. Prepare example/your-project-000.json
|
4
4
|
# 2. embulk bundle
|
5
|
-
# 3.
|
5
|
+
# 3. bundle exec ruby test/test_example.rb
|
6
6
|
|
7
|
-
|
7
|
+
unless File.exist?(JSON_KEYFILE)
|
8
|
+
puts "#{JSON_KEYFILE} is not found. Skip test/test_example.rb"
|
9
|
+
else
|
8
10
|
class TestExample < Test::Unit::TestCase
|
9
11
|
def embulk_path
|
10
12
|
if File.exist?("#{ENV['PATH']}/.embulk/bin/embulk")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-bigquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Satoshi Akama
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-api-client
|
@@ -159,9 +159,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
|
-
- - "
|
162
|
+
- - ">="
|
163
163
|
- !ruby/object:Gem::Version
|
164
|
-
version:
|
164
|
+
version: '0'
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project:
|
167
167
|
rubygems_version: 2.4.8
|