embulk-output-bigquery 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +3 -3
- data/embulk-output-bigquery.gemspec +1 -1
- data/example/config_gzip.yml +1 -1
- data/example/config_jsonl.yml +1 -1
- data/example/config_nested_record.yml +1 -1
- data/example/config_uncompressed.yml +1 -1
- data/example/example.yml +1 -1
- data/example/example2_1.csv +1 -1
- data/example/example2_2.csv +1 -1
- data/example/example4_1.csv +1 -1
- data/example/example4_2.csv +1 -1
- data/example/example4_3.csv +1 -1
- data/example/example4_4.csv +1 -1
- data/lib/embulk/output/bigquery.rb +2 -2
- data/lib/embulk/output/bigquery/bigquery_client.rb +9 -1
- data/lib/embulk/output/bigquery/google_client.rb +1 -0
- data/test/test_configure.rb +0 -2
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 860095ce62db6591bce595ae0dc7687ef821195c4462f9542ac711e1026fe986
|
4
|
+
data.tar.gz: a44f3f2925cb502d2c9a03ca0b8af7931582b6dd0112d4f50bc40a316e6877b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e89c528a2151b6a348f5b1d9a8a3f7cf2b2fe7d61a062a9d95c195255e9d3598ac529a401010b260eb5f3821ef4c1b432ac947cbda2445368dcac5a6683726d
|
7
|
+
data.tar.gz: 84f8250e8110add2c98fb2d164b11ad6307293a4172984a62e675579b8e83a5ac214e32a1a7b01c5a1fbf2f167389b10cb728eac4ecc9adb0490fdd6e453418b
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ v0.3.x has incompatibility changes with v0.2.x. Please see [CHANGELOG.md](CHANGE
|
|
49
49
|
| auto_create_table | boolean | optional | false | See [Dynamic Table Creating](#dynamic-table-creating) |
|
50
50
|
| schema_file | string | optional | | /path/to/schema.json |
|
51
51
|
| template_table | string | optional | | template table name. See [Dynamic Table Creating](#dynamic-table-creating) |
|
52
|
-
| prevent_duplicate_insert | boolean | optional | false | See [Prevent Duplication]
|
52
|
+
| prevent_duplicate_insert | boolean | optional | false | See [Prevent Duplication](#prevent-duplication) |
|
53
53
|
| job_status_max_polling_time | int | optional | 3600 sec | Max job status polling time |
|
54
54
|
| job_status_polling_interval | int | optional | 10 sec | Job status polling interval |
|
55
55
|
| is_skip_job_result_check | boolean | optional | false | Skip waiting Load job finishes. Available for append, or delete_in_advance mode |
|
@@ -315,7 +315,7 @@ However, this plugin is written in jruby, and jruby plugins are slower than java
|
|
315
315
|
|
316
316
|
Therefore, it is recommended to format records with filter plugins written in Java such as [embulk-filter-to_json](https://github.com/civitaspo/embulk-filter-to_json) as:
|
317
317
|
|
318
|
-
```
|
318
|
+
```yaml
|
319
319
|
filters:
|
320
320
|
- type: to_json
|
321
321
|
column: {name: payload, type: string}
|
@@ -327,7 +327,7 @@ out:
|
|
327
327
|
|
328
328
|
Furtheremore, if your files are originally jsonl or csv files, you can even skip a parser with [embulk-parser-none](https://github.com/sonots/embulk-parser-none) as:
|
329
329
|
|
330
|
-
```
|
330
|
+
```yaml
|
331
331
|
in:
|
332
332
|
type: file
|
333
333
|
path_prefix: example/example.jsonl
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "embulk-output-bigquery"
|
3
|
-
spec.version = "0.4.
|
3
|
+
spec.version = "0.4.6"
|
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."
|
data/example/config_gzip.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
config_csv.yml
|
1
|
+
example/config_csv.yml
|
data/example/config_jsonl.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
config_replace.yml
|
1
|
+
example/config_replace.yml
|
@@ -1 +1 @@
|
|
1
|
-
config_guess_with_column_options.yml
|
1
|
+
example/config_guess_with_column_options.yml
|
@@ -1 +1 @@
|
|
1
|
-
config_replace.yml
|
1
|
+
example/config_replace.yml
|
data/example/example.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
config_replace.yml
|
1
|
+
example/config_replace.yml
|
data/example/example2_1.csv
CHANGED
@@ -1 +1 @@
|
|
1
|
-
example.csv
|
1
|
+
example/example.csv
|
data/example/example2_2.csv
CHANGED
@@ -1 +1 @@
|
|
1
|
-
example.csv
|
1
|
+
example/example.csv
|
data/example/example4_1.csv
CHANGED
@@ -1 +1 @@
|
|
1
|
-
example.csv
|
1
|
+
example/example.csv
|
data/example/example4_2.csv
CHANGED
@@ -1 +1 @@
|
|
1
|
-
example.csv
|
1
|
+
example/example.csv
|
data/example/example4_3.csv
CHANGED
@@ -1 +1 @@
|
|
1
|
-
example.csv
|
1
|
+
example/example.csv
|
data/example/example4_4.csv
CHANGED
@@ -1 +1 @@
|
|
1
|
-
example.csv
|
1
|
+
example/example.csv
|
@@ -120,8 +120,8 @@ module Embulk
|
|
120
120
|
end
|
121
121
|
|
122
122
|
task['auth_method'] = task['auth_method'].downcase
|
123
|
-
unless %w[private_key json_key compute_engine].include?(task['auth_method'])
|
124
|
-
raise ConfigError.new "`auth_method` must be one of private_key, json_key, compute_engine"
|
123
|
+
unless %w[private_key json_key compute_engine application_default].include?(task['auth_method'])
|
124
|
+
raise ConfigError.new "`auth_method` must be one of private_key, json_key, compute_engine, application_default"
|
125
125
|
end
|
126
126
|
if task['auth_method'] == 'private_key' and task['p12_keyfile'].nil?
|
127
127
|
raise ConfigError.new "`p12_keyfile` is required for auth_method private_key"
|
@@ -8,6 +8,8 @@ module Embulk
|
|
8
8
|
module Output
|
9
9
|
class Bigquery < OutputPlugin
|
10
10
|
class BigqueryClient < GoogleClient
|
11
|
+
BIGQUERY_TABLE_OPERATION_INTERVAL = 2 # https://cloud.google.com/bigquery/quotas
|
12
|
+
|
11
13
|
def initialize(task, schema, fields = nil)
|
12
14
|
scope = "https://www.googleapis.com/auth/bigquery"
|
13
15
|
client_class = Google::Apis::BigqueryV2::BigqueryService
|
@@ -52,7 +54,11 @@ module Embulk
|
|
52
54
|
retries = 0
|
53
55
|
begin
|
54
56
|
yield
|
55
|
-
rescue BackendError, InternalError => e
|
57
|
+
rescue BackendError, InternalError, RateLimitExceeded => e
|
58
|
+
if e.is_a?(RateLimitExceeded)
|
59
|
+
sleep(BIGQUERY_TABLE_OPERATION_INTERVAL)
|
60
|
+
end
|
61
|
+
|
56
62
|
if retries < @task['retries']
|
57
63
|
retries += 1
|
58
64
|
Embulk.logger.warn { "embulk-output-bigquery: retry \##{retries}, #{e.message}" }
|
@@ -319,6 +325,8 @@ module Embulk
|
|
319
325
|
raise BackendError, msg
|
320
326
|
elsif _errors.any? {|error| error.reason == 'internalError' }
|
321
327
|
raise InternalError, msg
|
328
|
+
elsif _errors.any? {|error| error.reason == 'rateLimitExceeded' }
|
329
|
+
raise RateLimitExceeded, msg
|
322
330
|
else
|
323
331
|
Embulk.logger.error { "embulk-output-bigquery: #{msg}" }
|
324
332
|
raise Error, msg
|
data/test/test_configure.rb
CHANGED
@@ -69,8 +69,6 @@ module Embulk
|
|
69
69
|
assert_equal "%Y-%m-%d %H:%M:%S.%6N", task['default_timestamp_format']
|
70
70
|
assert_equal nil, task['payload_column']
|
71
71
|
assert_equal nil, task['payload_column_index']
|
72
|
-
assert_equal 300, task['timeout_sec']
|
73
|
-
assert_equal 300, task['open_timeout_sec']
|
74
72
|
assert_equal 5, task['retries']
|
75
73
|
assert_equal "Embulk BigQuery plugin", task['application_name']
|
76
74
|
# assert_equal "/tmp/embulk_output_bigquery_20160228-27184-pubcn0", task['path_prefix']
|
metadata
CHANGED
@@ -1,81 +1,81 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-bigquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Satoshi Akama
|
8
8
|
- Naotoshi Seo
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: google-api-client
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
17
|
- - ">="
|
19
18
|
- !ruby/object:Gem::Version
|
20
19
|
version: '0'
|
21
|
-
|
20
|
+
name: google-api-client
|
22
21
|
prerelease: false
|
22
|
+
type: :runtime
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name: time_with_zone
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
31
|
- - ">="
|
33
32
|
- !ruby/object:Gem::Version
|
34
33
|
version: '0'
|
35
|
-
|
34
|
+
name: time_with_zone
|
36
35
|
prerelease: false
|
36
|
+
type: :runtime
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name: embulk
|
44
43
|
requirement: !ruby/object:Gem::Requirement
|
45
44
|
requirements:
|
46
45
|
- - ">="
|
47
46
|
- !ruby/object:Gem::Version
|
48
47
|
version: 0.8.2
|
49
|
-
|
48
|
+
name: embulk
|
50
49
|
prerelease: false
|
50
|
+
type: :development
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.8.2
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name: bundler
|
58
57
|
requirement: !ruby/object:Gem::Requirement
|
59
58
|
requirements:
|
60
59
|
- - ">="
|
61
60
|
- !ruby/object:Gem::Version
|
62
61
|
version: 1.10.6
|
63
|
-
|
62
|
+
name: bundler
|
64
63
|
prerelease: false
|
64
|
+
type: :development
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.10.6
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
|
-
name: rake
|
72
71
|
requirement: !ruby/object:Gem::Requirement
|
73
72
|
requirements:
|
74
73
|
- - ">="
|
75
74
|
- !ruby/object:Gem::Version
|
76
75
|
version: '10.0'
|
77
|
-
|
76
|
+
name: rake
|
78
77
|
prerelease: false
|
78
|
+
type: :development
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
@@ -159,7 +159,7 @@ homepage: https://github.com/embulk/embulk-output-bigquery
|
|
159
159
|
licenses:
|
160
160
|
- MIT
|
161
161
|
metadata: {}
|
162
|
-
post_install_message:
|
162
|
+
post_install_message:
|
163
163
|
rdoc_options: []
|
164
164
|
require_paths:
|
165
165
|
- lib
|
@@ -174,9 +174,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
|
-
rubyforge_project:
|
178
|
-
rubygems_version: 2.
|
179
|
-
signing_key:
|
177
|
+
rubyforge_project:
|
178
|
+
rubygems_version: 2.6.11
|
179
|
+
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Google BigQuery output plugin for Embulk
|
182
182
|
test_files:
|