embulk-output-bigquery 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -1
- data/embulk-output-bigquery.gemspec +1 -1
- data/lib/embulk/output/bigquery.rb +1 -1
- data/lib/embulk/output/bigquery/gcs_client.rb +16 -4
- 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: 1b02f82363fcc5b0d7ee79ede178abb05f7ccd261f999fde60c382a86c694620
|
4
|
+
data.tar.gz: 94541e8c719c18b3c1d02a16617cc2daabef545a354c35bdbd2c19b6490d24dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cc25e352180cecbe6502d031e1eda10c8bfd566b407467bffacef04b45f993ddcc0976ee09a46314453c661306ba1d2604d1ae5c3bac7633f28ea2faa4eb071
|
7
|
+
data.tar.gz: f11b24264d4ace3576581da99c29a561af6eb5c26a230a9fc6fc11ef897b7f44d1645c2fdfbea9cd347e21addbff6d3340baf9c9a7a1560d00a18b49761242fd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
## 0.4.9 - 2018-09-08
|
2
|
+
* [enhancement] Enable object lifecycle management when creating buckets with `auto_create_gcs_bucket` (thanks to @potato2003)
|
3
|
+
|
1
4
|
## 0.4.8 - 2017-05-23
|
2
|
-
* [enhancement] Support location option for auto_create_gcs_bucket option (thanks to @potato2003)
|
5
|
+
* [enhancement] Support location option for `auto_create_gcs_bucket` option (thanks to @potato2003)
|
3
6
|
|
4
7
|
## 0.4.7 - 2017-05-02
|
5
8
|
* [enhancement] Support location option to allow to use 'asia-northeast1' region
|
@@ -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.9"
|
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."
|
@@ -372,7 +372,7 @@ module Embulk
|
|
372
372
|
target_table = task['temp_table'] ? task['temp_table'] : task['table']
|
373
373
|
if bucket = task['gcs_bucket']
|
374
374
|
gcs = GcsClient.new(task)
|
375
|
-
gcs.
|
375
|
+
gcs.insert_temporary_bucket(bucket) if task['auto_create_gcs_bucket']
|
376
376
|
objects = paths.size.times.map { SecureRandom.uuid.to_s }
|
377
377
|
gcs.insert_objects(paths, objects: objects, bucket: bucket)
|
378
378
|
object_uris = objects.map {|object| URI.join("gs://#{bucket}", object).to_s }
|
@@ -20,12 +20,24 @@ module Embulk
|
|
20
20
|
@location = @task['location']
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def insert_temporary_bucket(bucket = nil)
|
24
24
|
bucket ||= @bucket
|
25
25
|
begin
|
26
26
|
Embulk.logger.info { "embulk-output-bigquery: Insert bucket... #{@project}:#{bucket}" }
|
27
27
|
body = {
|
28
|
-
name: bucket
|
28
|
+
name: bucket,
|
29
|
+
lifecycle: {
|
30
|
+
rule: [
|
31
|
+
{
|
32
|
+
action: {
|
33
|
+
type: "Delete",
|
34
|
+
},
|
35
|
+
condition: {
|
36
|
+
age: 1,
|
37
|
+
}
|
38
|
+
},
|
39
|
+
]
|
40
|
+
}
|
29
41
|
}
|
30
42
|
|
31
43
|
if @location
|
@@ -34,7 +46,7 @@ module Embulk
|
|
34
46
|
|
35
47
|
opts = {}
|
36
48
|
|
37
|
-
Embulk.logger.debug { "embulk-output-bigquery:
|
49
|
+
Embulk.logger.debug { "embulk-output-bigquery: insert_temporary_bucket(#{@project}, #{body}, #{opts})" }
|
38
50
|
with_network_retry { client.insert_bucket(@project, body, opts) }
|
39
51
|
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
|
40
52
|
if e.status_code == 409 && /conflict:/ =~ e.message
|
@@ -43,7 +55,7 @@ module Embulk
|
|
43
55
|
end
|
44
56
|
response = {status_code: e.status_code, message: e.message, error_class: e.class}
|
45
57
|
Embulk.logger.error {
|
46
|
-
"embulk-output-bigquery:
|
58
|
+
"embulk-output-bigquery: insert_temporary_bucket(#{@project}, #{body}, #{opts}), response:#{response}"
|
47
59
|
}
|
48
60
|
raise Error, "failed to insert bucket #{@project}:#{bucket}, response:#{response}"
|
49
61
|
end
|
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.9
|
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: 2018-
|
12
|
+
date: 2018-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
name: google-api-client
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
18
|
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
20
|
version: '0'
|
20
|
-
name: google-api-client
|
21
|
-
prerelease: false
|
22
21
|
type: :runtime
|
22
|
+
prerelease: false
|
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
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
32
|
- - ">="
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: '0'
|
34
|
-
name: time_with_zone
|
35
|
-
prerelease: false
|
36
35
|
type: :runtime
|
36
|
+
prerelease: false
|
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
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
46
|
- - ">="
|
46
47
|
- !ruby/object:Gem::Version
|
47
48
|
version: 0.8.2
|
48
|
-
name: embulk
|
49
|
-
prerelease: false
|
50
49
|
type: :development
|
50
|
+
prerelease: false
|
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
|
57
58
|
requirement: !ruby/object:Gem::Requirement
|
58
59
|
requirements:
|
59
60
|
- - ">="
|
60
61
|
- !ruby/object:Gem::Version
|
61
62
|
version: 1.10.6
|
62
|
-
name: bundler
|
63
|
-
prerelease: false
|
64
63
|
type: :development
|
64
|
+
prerelease: false
|
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
|
71
72
|
requirement: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
74
|
- - ">="
|
74
75
|
- !ruby/object:Gem::Version
|
75
76
|
version: '10.0'
|
76
|
-
name: rake
|
77
|
-
prerelease: false
|
78
77
|
type: :development
|
78
|
+
prerelease: false
|
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.7.4
|
179
|
+
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Google BigQuery output plugin for Embulk
|
182
182
|
test_files:
|