kura 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +6 -0
- data/lib/kura/client.rb +30 -0
- data/lib/kura/version.rb +1 -1
- 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: 21bc7162d31e2dbf76656f90c3d69db812c7d8aa
|
4
|
+
data.tar.gz: d6f21b718169fb247c0a243ec49d8408b2ba4788
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 378a26e155f0acf77dc400e6baed0866dabafec76cebf5b85cc8ca3e089d3dabf491f1b983a324425d58261895bcc34e8ee9fc4af1152e15af8298b4ea64dfca
|
7
|
+
data.tar.gz: 396bc763df427fcd9e29cd8991f38cc92740d189d16d16ada211497ddf858b9eb5c7b6d1673e088fdaa44a2881ff7cddf66f98c1c1f2f7fdcd065d93d2c3d651
|
data/ChangeLog.md
CHANGED
data/lib/kura/client.rb
CHANGED
@@ -253,6 +253,36 @@ module Kura
|
|
253
253
|
process_error($!)
|
254
254
|
end
|
255
255
|
|
256
|
+
def insert_tabledata(dataset_id, table_id, rows, project_id: @default_project_id, ignore_unknown_values: false, skip_invalid_rows: false, template_suffix: nil)
|
257
|
+
request = Google::Apis::BigqueryV2::InsertAllTableDataRequest.new
|
258
|
+
request.ignore_unknown_values = ignore_unknown_values
|
259
|
+
request.skip_invalid_rows = skip_invalid_rows
|
260
|
+
if template_suffix
|
261
|
+
request.template_suffix = template_suffix
|
262
|
+
end
|
263
|
+
request.rows = rows.map do |r|
|
264
|
+
case r
|
265
|
+
when Google::Apis::BigqueryV2::InsertAllTableDataRequest::Row
|
266
|
+
r
|
267
|
+
when Hash
|
268
|
+
row = Google::Apis::BigqueryV2::InsertAllTableDataRequest::Row.new
|
269
|
+
if r.keys.map(&:to_s) == %w{ insert_id json }
|
270
|
+
row.insert_id = r[:insert_id] || r["insert_id"]
|
271
|
+
row.json = r[:json] || r["json"]
|
272
|
+
else
|
273
|
+
row.json = r
|
274
|
+
end
|
275
|
+
row
|
276
|
+
else
|
277
|
+
raise ArgumentError, "invalid row for BigQuery tabledata.insertAll #{r.inspect}"
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
r = @api.insert_all_table_data(project_id, dataset_id, table_id, request)
|
282
|
+
rescue
|
283
|
+
process_error($!)
|
284
|
+
end
|
285
|
+
|
256
286
|
def mode_to_write_disposition(mode)
|
257
287
|
unless %i{ append truncate empty }.include?(mode)
|
258
288
|
raise "mode option should be one of :append, :truncate, :empty but #{mode}"
|
data/lib/kura/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kura
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chikanaga Tomoyuki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02
|
11
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|