fluent-plugin-bigquery 0.5.0.beta1 → 0.5.0.beta2
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/README.md +1 -0
- data/lib/fluent/plugin/bigquery/version.rb +1 -1
- data/lib/fluent/plugin/bigquery/writer.rb +8 -2
- data/lib/fluent/plugin/out_bigquery.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 023c14a3ce8139a7b7cc9670ba7e5046e9d7407b
|
4
|
+
data.tar.gz: 7d5988af8f30c05149cb1f92770f72ab677074ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48327b0270d7fe66913fbabd04b6e09a3270808ff28d83cfcfde30f8985b333f493e007350d3f0cca7d495bd9d57856ad48f974f851781eed66cdb40b0f705f5
|
7
|
+
data.tar.gz: 8522ffdfc297465313938ee2c9d6fff5979c390b5c82e70e192774136288df19111db24b42d08654505e84e920776c2db4b1967bd989f2539d93a7b2741f58b7
|
data/README.md
CHANGED
@@ -59,6 +59,7 @@ Because embbeded gem dependency sometimes restricts ruby environment.
|
|
59
59
|
| replace_record_key_regexp{1-10} | string | no | no | nil | see examples. |
|
60
60
|
| convert_hash_to_json | bool | no | no | false | If true, converts Hash value of record to JSON String. |
|
61
61
|
| insert_id_field | string | no | no | nil | Use key as `insert_id` of Streaming Insert API parameter. |
|
62
|
+
| add_insert_timestamp | string | no | no | nil | Adds a timestamp column just before sending the rows to BigQuery, so that buffering time is not taken into account. Gives a field in BigQuery which represents the insert time of the row. |
|
62
63
|
| allow_retry_insert_errors | bool | no | false | Retry to insert rows when an insertErrors occurs. There is a possibility that rows are inserted in duplicate. |
|
63
64
|
| request_timeout_sec | integer | no | no | nil | Bigquery API response timeout |
|
64
65
|
| request_open_timeout_sec | integer | no | no | 60 | Bigquery API connection, and request timeout. If you send big data to Bigquery, set large value. |
|
@@ -113,9 +113,15 @@ module Fluent
|
|
113
113
|
@client = nil
|
114
114
|
|
115
115
|
reason = e.respond_to?(:reason) ? e.reason : nil
|
116
|
-
|
116
|
+
error_data = { project_id: project, dataset: dataset, table: table_id, code: e.status_code, message: e.message, reason: reason }
|
117
|
+
wrapped = Fluent::BigQuery::Error.wrap(e)
|
118
|
+
if wrapped.retryable?
|
119
|
+
log.warn "tabledata.insertAll API", error_data
|
120
|
+
else
|
121
|
+
log.error "tabledata.insertAll API", error_data
|
122
|
+
end
|
117
123
|
|
118
|
-
raise
|
124
|
+
raise wrapped
|
119
125
|
end
|
120
126
|
|
121
127
|
def create_load_job(chunk_id, project, dataset, table_id, upload_source, fields)
|
@@ -118,6 +118,12 @@ module Fluent
|
|
118
118
|
# prevent_duplicate_load (only load)
|
119
119
|
config_param :prevent_duplicate_load, :bool, default: false
|
120
120
|
|
121
|
+
# add_insert_timestamp (only insert)
|
122
|
+
# adds a timestamp just before sending the rows to bigquery, so that
|
123
|
+
# buffering time is not taken into account. Gives a field in bigquery
|
124
|
+
# which represents the insert time of the row.
|
125
|
+
config_param :add_insert_timestamp, :string, default: nil
|
126
|
+
|
121
127
|
config_param :method, :enum, list: [:insert, :load], default: :insert, skip_accessor: true
|
122
128
|
|
123
129
|
# allow_retry_insert_errors (only insert)
|
@@ -398,9 +404,11 @@ module Fluent
|
|
398
404
|
|
399
405
|
module InsertImplementation
|
400
406
|
def _write(chunk, table_format)
|
407
|
+
now = Time.now.utc.strftime("%Y-%m-%d %H:%M:%S.%6N") if @add_insert_timestamp
|
401
408
|
rows = chunk.open do |io|
|
402
409
|
io.map do |line|
|
403
410
|
record = MultiJson.load(line)
|
411
|
+
record[@add_insert_timestamp] = now if @add_insert_timestamp
|
404
412
|
row = {"json" => record}
|
405
413
|
row["insert_id"] = @get_insert_id.call(record) if @get_insert_id
|
406
414
|
row.deep_symbolize_keys
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-bigquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0.
|
4
|
+
version: 0.5.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naoya Ito
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-04-
|
12
|
+
date: 2017-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|