embulk-output-bigquery 0.6.9 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/check.yml +42 -0
- data/.github/workflows/publish.yml +41 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +1 -2
- data/README.md +7 -2
- data/embulk-output-bigquery.gemspec +7 -12
- data/lib/embulk/output/bigquery/bigquery_client.rb +5 -5
- data/test/helper.rb +7 -7
- data/test/test_transaction.rb +7 -7
- metadata +19 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36a45d63bf6d79411d67ef26d736e3a55035220b92923f208c8e08c7af5aeeae
|
4
|
+
data.tar.gz: 3be9cdc0cfd8c05cc7d6f427ba6aa9a4091220c8eb5b4cef8786cde8d86a86bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a112e890334fa11d95ebfa40719654f7c6a78ea3fcda19edc141060f68516b748353ca76c2f1e35d1b2ea6ba9aec852f6279f91d0d57879387786465e8651d03
|
7
|
+
data.tar.gz: 776ad5a340e420874b5ff9daa2860797fe9a656ce2f8fc3585ab4aff8d671f2725628803cacccfe54c10a68acefe956f73aa3b717a243aebd1566bf68ab7068f
|
@@ -0,0 +1,42 @@
|
|
1
|
+
name: Check
|
2
|
+
on: [ pull_request, push ]
|
3
|
+
jobs:
|
4
|
+
check:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
# push: always run.
|
7
|
+
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
|
8
|
+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
jruby_version:
|
12
|
+
- 9.3.10.0
|
13
|
+
- 9.4.2.0
|
14
|
+
fail-fast: false
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- name: Set up OpenJDK 8
|
18
|
+
uses: actions/setup-java@v3
|
19
|
+
with:
|
20
|
+
java-version: 8
|
21
|
+
distribution: "temurin"
|
22
|
+
- uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: 'jruby-${{ matrix.jruby_version }}'
|
25
|
+
bundler-cache: true
|
26
|
+
- name: show ruby version
|
27
|
+
run: ruby -v
|
28
|
+
- name: bundle install
|
29
|
+
run: bundle install
|
30
|
+
#
|
31
|
+
# This step avoids the following error in the JRuby 9.4 test.
|
32
|
+
#
|
33
|
+
# Gem::LoadError: You have already activated rake 13.0.6,
|
34
|
+
# but your Gemfile requires rake 13.1.0. Prepending
|
35
|
+
# `bundle exec` to your command may solve this.
|
36
|
+
#
|
37
|
+
- name: install rake 13.1.0
|
38
|
+
run: gem install rake -v 13.1.0
|
39
|
+
- name: install embulk.jar
|
40
|
+
run: "curl -L -o embulk.jar https://github.com/embulk/embulk/releases/download/v0.10.49/embulk-0.10.49.jar"
|
41
|
+
- name: rake test
|
42
|
+
run: bundle exec env RUBYOPT="-r ./embulk.jar" rake test
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: Publish
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
tags:
|
5
|
+
- "v0.*"
|
6
|
+
jobs:
|
7
|
+
publish:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
environment: maven-central-and-ruby-gems
|
10
|
+
strategy:
|
11
|
+
fail-fast: true
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v4
|
14
|
+
- name: Set up Ruby
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 3.3.0
|
18
|
+
# get tag variable using {{ github.ref_name }}
|
19
|
+
#
|
20
|
+
# References:
|
21
|
+
# * https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
|
22
|
+
# * https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
|
23
|
+
- name: extract gem version from tag
|
24
|
+
id: vars
|
25
|
+
run: echo version=${{ github.ref_name }} | sed -e 's/v0/0/' >> $GITHUB_OUTPUT
|
26
|
+
#
|
27
|
+
# From gem push documents.
|
28
|
+
#
|
29
|
+
# The push command will use ~/.gem/credentials to authenticate to a server,
|
30
|
+
# but you can use the RubyGems environment variable GEM_HOST_API_KEY
|
31
|
+
# to set the api key to authenticate.
|
32
|
+
#
|
33
|
+
# https://guides.rubygems.org/command-reference/#gem-push
|
34
|
+
#
|
35
|
+
- name: Publish
|
36
|
+
run: |
|
37
|
+
rake build
|
38
|
+
gem push pkg/${EMBULK_PLUGIN_NAME}-${{ steps.vars.outputs.version }}.gem
|
39
|
+
env:
|
40
|
+
EMBULK_PLUGIN_NAME: embulk-output-bigquery
|
41
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# embulk-output-bigquery
|
2
2
|
|
3
|
-
[![Build Status](https://secure.travis-ci.org/embulk/embulk-output-bigquery.png?branch=master)](http://travis-ci.org/embulk/embulk-output-bigquery)
|
4
|
-
|
5
3
|
[Embulk](https://github.com/embulk/embulk/) output plugin to load/insert data into [Google BigQuery](https://cloud.google.com/bigquery/) using [direct insert](https://cloud.google.com/bigquery/loading-data-into-bigquery#loaddatapostrequest)
|
6
4
|
|
7
5
|
## Overview
|
@@ -14,6 +12,13 @@ https://developers.google.com/bigquery/loading-data-into-bigquery
|
|
14
12
|
* **Cleanup supported**: no
|
15
13
|
* **Dynamic table creating**: yes
|
16
14
|
|
15
|
+
### Supported Embulk
|
16
|
+
|
17
|
+
| gem version | Embulk version |
|
18
|
+
|------------------|--------------------|
|
19
|
+
| 0.7.0 and higher | v0.11.0 and higher |
|
20
|
+
| 0.6.9 and lower | v0.9.X and lower |
|
21
|
+
|
17
22
|
### NOT IMPLEMENTED
|
18
23
|
* insert data over streaming inserts
|
19
24
|
* for continuous real-time insertions
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "embulk-output-bigquery"
|
3
|
-
spec.version = "0.
|
3
|
+
spec.version = "0.7.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."
|
@@ -14,18 +14,13 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.test_files = spec.files.grep(%r{^(test|spec)/})
|
15
15
|
spec.require_paths = ["lib"]
|
16
16
|
|
17
|
-
#
|
18
|
-
|
19
|
-
# Embulk 0.9 use JRuby 9.1.X.Y and it's compatible with Ruby 2.3.
|
20
|
-
# So, force install signet < 0.12 and google-api-client < 0.33.0
|
21
|
-
# Also, representable version >= 3.1.0 requires Ruby version >= 2.4
|
22
|
-
spec.add_dependency 'signet', '~> 0.7', '< 0.12.0'
|
23
|
-
spec.add_dependency 'google-api-client','< 0.33.0'
|
17
|
+
# the latest version
|
18
|
+
spec.add_dependency 'google-api-client','= 0.53.0'
|
24
19
|
spec.add_dependency 'time_with_zone'
|
25
|
-
spec.add_dependency
|
26
|
-
#
|
27
|
-
#
|
28
|
-
spec.add_dependency
|
20
|
+
spec.add_dependency 'thwait'
|
21
|
+
# activesupport require Ruby >= 2.7.0
|
22
|
+
# jruby-9.3.0.0 is MRI 2.6 compatible
|
23
|
+
spec.add_dependency 'activesupport', "< 7.0"
|
29
24
|
|
30
25
|
spec.add_development_dependency 'bundler', ['>= 1.10.6']
|
31
26
|
spec.add_development_dependency 'rake', ['>= 10.0']
|
@@ -121,7 +121,7 @@ module Embulk
|
|
121
121
|
opts = {}
|
122
122
|
|
123
123
|
Embulk.logger.debug { "embulk-output-bigquery: insert_job(#{@project}, #{body}, #{opts})" }
|
124
|
-
response = with_network_retry { client.insert_job(@project, body, opts) }
|
124
|
+
response = with_network_retry { client.insert_job(@project, body, **opts) }
|
125
125
|
unless @task['is_skip_job_result_check']
|
126
126
|
response = wait_load('Load', response)
|
127
127
|
end
|
@@ -222,7 +222,7 @@ module Embulk
|
|
222
222
|
# },
|
223
223
|
}
|
224
224
|
Embulk.logger.debug { "embulk-output-bigquery: insert_job(#{@project}, #{body}, #{opts})" }
|
225
|
-
response = with_network_retry { client.insert_job(@project, body, opts) }
|
225
|
+
response = with_network_retry { client.insert_job(@project, body, **opts) }
|
226
226
|
if @task['is_skip_job_result_check']
|
227
227
|
response
|
228
228
|
else
|
@@ -278,7 +278,7 @@ module Embulk
|
|
278
278
|
|
279
279
|
opts = {}
|
280
280
|
Embulk.logger.debug { "embulk-output-bigquery: insert_job(#{@project}, #{body}, #{opts})" }
|
281
|
-
response = with_network_retry { client.insert_job(@project, body, opts) }
|
281
|
+
response = with_network_retry { client.insert_job(@project, body, **opts) }
|
282
282
|
wait_load('Copy', response)
|
283
283
|
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
|
284
284
|
response = {status_code: e.status_code, message: e.message, error_class: e.class}
|
@@ -372,7 +372,7 @@ module Embulk
|
|
372
372
|
end
|
373
373
|
opts = {}
|
374
374
|
Embulk.logger.debug { "embulk-output-bigquery: insert_dataset(#{@project}, #{dataset}, #{@location_for_log}, #{body}, #{opts})" }
|
375
|
-
with_network_retry { client.insert_dataset(@project, body, opts) }
|
375
|
+
with_network_retry { client.insert_dataset(@project, body, **opts) }
|
376
376
|
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
|
377
377
|
if e.status_code == 409 && /Already Exists:/ =~ e.message
|
378
378
|
# ignore 'Already Exists' error
|
@@ -447,7 +447,7 @@ module Embulk
|
|
447
447
|
|
448
448
|
opts = {}
|
449
449
|
Embulk.logger.debug { "embulk-output-bigquery: insert_table(#{@project}, #{dataset}, #{@location_for_log}, #{body}, #{opts})" }
|
450
|
-
with_network_retry { client.insert_table(@project, dataset, body, opts) }
|
450
|
+
with_network_retry { client.insert_table(@project, dataset, body, **opts) }
|
451
451
|
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
|
452
452
|
if e.status_code == 409 && /Already Exists:/ =~ e.message
|
453
453
|
# ignore 'Already Exists' error
|
data/test/helper.rb
CHANGED
@@ -4,14 +4,14 @@ require 'bundler/setup'
|
|
4
4
|
require 'test/unit'
|
5
5
|
require 'test/unit/rr'
|
6
6
|
|
7
|
+
# Embulk 0.10.x introduced new bootstrap mechanism.
|
8
|
+
# https://github.com/embulk/embulk/blob/641f35fec064cca7b1a7314d634a4b64ef8637f1/embulk-ruby/test/vanilla/run-test.rb#L8-L13
|
9
|
+
static_initializer = Java::org.embulk.EmbulkDependencyClassLoader.staticInitializer().useSelfContainedJarFiles()
|
10
|
+
static_initializer.java_send :initialize
|
11
|
+
|
12
|
+
require 'embulk/java/bootstrap'
|
7
13
|
require 'embulk'
|
8
|
-
|
9
|
-
# Embulk ~> 0.8.x
|
10
|
-
Embulk.setup
|
11
|
-
rescue NotImplementedError, NoMethodError, NameError
|
12
|
-
# Embulk ~> 0.9.x
|
13
|
-
require 'embulk/java/bootstrap'
|
14
|
-
end
|
14
|
+
|
15
15
|
Embulk.logger = Embulk::Logger.new('/dev/null')
|
16
16
|
|
17
17
|
APP_ROOT = File.expand_path('../', __dir__)
|
data/test/test_transaction.rb
CHANGED
@@ -109,7 +109,7 @@ module Embulk
|
|
109
109
|
task = Bigquery.configure(config, schema, processor_count)
|
110
110
|
any_instance_of(BigqueryClient) do |obj|
|
111
111
|
mock(obj).get_dataset(config['dataset'])
|
112
|
-
mock(obj).create_table_if_not_exists(config['temp_table'])
|
112
|
+
mock(obj).create_table_if_not_exists(config['temp_table'], options: {"expiration_time"=>nil})
|
113
113
|
mock(obj).create_table_if_not_exists(config['table'])
|
114
114
|
mock(obj).copy(config['temp_table'], config['table'], write_disposition: 'WRITE_TRUNCATE')
|
115
115
|
mock(obj).delete_table(config['temp_table'])
|
@@ -122,7 +122,7 @@ module Embulk
|
|
122
122
|
task = Bigquery.configure(config, schema, processor_count)
|
123
123
|
any_instance_of(BigqueryClient) do |obj|
|
124
124
|
mock(obj).get_dataset(config['dataset'])
|
125
|
-
mock(obj).create_table_if_not_exists(config['temp_table'])
|
125
|
+
mock(obj).create_table_if_not_exists(config['temp_table'], options: {"expiration_time"=>nil})
|
126
126
|
mock(obj).create_table_if_not_exists(config['table'])
|
127
127
|
mock(obj).copy(config['temp_table'], config['table'], write_disposition: 'WRITE_TRUNCATE')
|
128
128
|
mock(obj).delete_table(config['temp_table'])
|
@@ -138,7 +138,7 @@ module Embulk
|
|
138
138
|
any_instance_of(BigqueryClient) do |obj|
|
139
139
|
mock(obj).get_dataset(config['dataset'])
|
140
140
|
mock(obj).get_dataset(config['dataset_old'])
|
141
|
-
mock(obj).create_table_if_not_exists(config['temp_table'])
|
141
|
+
mock(obj).create_table_if_not_exists(config['temp_table'], options: {"expiration_time"=>nil})
|
142
142
|
mock(obj).create_table_if_not_exists(config['table'])
|
143
143
|
mock(obj).create_table_if_not_exists(config['table_old'], dataset: config['dataset_old'])
|
144
144
|
|
@@ -158,7 +158,7 @@ module Embulk
|
|
158
158
|
mock(obj).create_dataset(config['dataset'])
|
159
159
|
mock(obj).create_dataset(config['dataset_old'], reference: config['dataset'])
|
160
160
|
mock(obj).create_table_if_not_exists(config['table'])
|
161
|
-
mock(obj).create_table_if_not_exists(config['temp_table'])
|
161
|
+
mock(obj).create_table_if_not_exists(config['temp_table'], options: {"expiration_time"=>nil})
|
162
162
|
mock(obj).create_table_if_not_exists(config['table_old'], dataset: config['dataset_old'])
|
163
163
|
|
164
164
|
mock(obj).get_table_or_partition(config['table'])
|
@@ -176,7 +176,7 @@ module Embulk
|
|
176
176
|
any_instance_of(BigqueryClient) do |obj|
|
177
177
|
mock(obj).get_dataset(config['dataset'])
|
178
178
|
mock(obj).get_dataset(config['dataset_old'])
|
179
|
-
mock(obj).create_table_if_not_exists(config['temp_table'])
|
179
|
+
mock(obj).create_table_if_not_exists(config['temp_table'], options: {"expiration_time"=>nil})
|
180
180
|
mock(obj).create_table_if_not_exists(config['table'])
|
181
181
|
mock(obj).create_table_if_not_exists(config['table_old'], dataset: config['dataset_old'])
|
182
182
|
|
@@ -196,7 +196,7 @@ module Embulk
|
|
196
196
|
task = Bigquery.configure(config, schema, processor_count)
|
197
197
|
any_instance_of(BigqueryClient) do |obj|
|
198
198
|
mock(obj).get_dataset(config['dataset'])
|
199
|
-
mock(obj).create_table_if_not_exists(config['temp_table'])
|
199
|
+
mock(obj).create_table_if_not_exists(config['temp_table'], options: {"expiration_time"=>nil})
|
200
200
|
mock(obj).create_table_if_not_exists(config['table'])
|
201
201
|
mock(obj).copy(config['temp_table'], config['table'], write_disposition: 'WRITE_APPEND')
|
202
202
|
mock(obj).delete_table(config['temp_table'])
|
@@ -209,7 +209,7 @@ module Embulk
|
|
209
209
|
task = Bigquery.configure(config, schema, processor_count)
|
210
210
|
any_instance_of(BigqueryClient) do |obj|
|
211
211
|
mock(obj).get_dataset(config['dataset'])
|
212
|
-
mock(obj).create_table_if_not_exists(config['temp_table'])
|
212
|
+
mock(obj).create_table_if_not_exists(config['temp_table'], options: {"expiration_time"=>nil})
|
213
213
|
mock(obj).create_table_if_not_exists(config['table'])
|
214
214
|
mock(obj).copy(config['temp_table'], config['table'], write_disposition: 'WRITE_APPEND')
|
215
215
|
mock(obj).delete_table(config['temp_table'])
|
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.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Satoshi Akama
|
@@ -9,42 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: signet
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0.7'
|
21
|
-
- - "<"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.12.0
|
24
|
-
type: :runtime
|
25
|
-
prerelease: false
|
26
|
-
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
requirements:
|
28
|
-
- - "~>"
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '0.7'
|
31
|
-
- - "<"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.12.0
|
34
14
|
- !ruby/object:Gem::Dependency
|
35
15
|
name: google-api-client
|
36
16
|
requirement: !ruby/object:Gem::Requirement
|
37
17
|
requirements:
|
38
|
-
- -
|
18
|
+
- - '='
|
39
19
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
20
|
+
version: 0.53.0
|
41
21
|
type: :runtime
|
42
22
|
prerelease: false
|
43
23
|
version_requirements: !ruby/object:Gem::Requirement
|
44
24
|
requirements:
|
45
|
-
- -
|
25
|
+
- - '='
|
46
26
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
27
|
+
version: 0.53.0
|
48
28
|
- !ruby/object:Gem::Dependency
|
49
29
|
name: time_with_zone
|
50
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,39 +40,33 @@ dependencies:
|
|
60
40
|
- !ruby/object:Gem::Version
|
61
41
|
version: '0'
|
62
42
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
43
|
+
name: thwait
|
64
44
|
requirement: !ruby/object:Gem::Requirement
|
65
45
|
requirements:
|
66
|
-
- - "
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 3.0.0
|
69
|
-
- - "<"
|
46
|
+
- - ">="
|
70
47
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
48
|
+
version: '0'
|
72
49
|
type: :runtime
|
73
50
|
prerelease: false
|
74
51
|
version_requirements: !ruby/object:Gem::Requirement
|
75
52
|
requirements:
|
76
|
-
- - "
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 3.0.0
|
79
|
-
- - "<"
|
53
|
+
- - ">="
|
80
54
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
55
|
+
version: '0'
|
82
56
|
- !ruby/object:Gem::Dependency
|
83
|
-
name:
|
57
|
+
name: activesupport
|
84
58
|
requirement: !ruby/object:Gem::Requirement
|
85
59
|
requirements:
|
86
|
-
- - "
|
60
|
+
- - "<"
|
87
61
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0
|
62
|
+
version: '7.0'
|
89
63
|
type: :runtime
|
90
64
|
prerelease: false
|
91
65
|
version_requirements: !ruby/object:Gem::Requirement
|
92
66
|
requirements:
|
93
|
-
- - "
|
67
|
+
- - "<"
|
94
68
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0
|
69
|
+
version: '7.0'
|
96
70
|
- !ruby/object:Gem::Dependency
|
97
71
|
name: bundler
|
98
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,6 +103,8 @@ executables: []
|
|
129
103
|
extensions: []
|
130
104
|
extra_rdoc_files: []
|
131
105
|
files:
|
106
|
+
- ".github/workflows/check.yml"
|
107
|
+
- ".github/workflows/publish.yml"
|
132
108
|
- ".gitignore"
|
133
109
|
- ".travis.yml"
|
134
110
|
- CHANGELOG.md
|
@@ -172,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
148
|
- !ruby/object:Gem::Version
|
173
149
|
version: '0'
|
174
150
|
requirements: []
|
175
|
-
rubygems_version: 3.3
|
151
|
+
rubygems_version: 3.5.3
|
176
152
|
signing_key:
|
177
153
|
specification_version: 4
|
178
154
|
summary: Google BigQuery output plugin for Embulk
|