kura 0.6.3 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15a436e39cec7d1079d4b83e4deb84ce310c26ddc5798163f950cf3ab353d79b
4
- data.tar.gz: 7f96eee9e1f02df06f0535b50dc188c8414f84a0e3f6ca28ab539cffe2f0eb9c
3
+ metadata.gz: e1aa656b398dff0f7b0275a11205472120d90ec289af14ccafb1102fecb2f198
4
+ data.tar.gz: '039fdf19cbcda9415af67396d3f800d3309d0c508f9bb9fcdbabbb3ab6ac2100'
5
5
  SHA512:
6
- metadata.gz: 3da32573e83e77d4268a5e4982aea642470222db5ee16ee61ea9708b1771784c651f76d68432158ab08fcddfd640d5f14123ba0dd1d23afdefb1e0895f1a61e4
7
- data.tar.gz: 7e3f51be7307bcd248ffc4cedf9dfa45b0c37b4f4e490932f81bc0986e1e07e0386242a3f8b86579bb1bd3b44af1c3e1f4c06c8a66bfa369e61f809dba312aa1
6
+ metadata.gz: 67b64f845e5badd762d5363c0f19373fa44186ba501205d9ea1ab088f699867b42c6d1b10ccb8b368b730435cf9c4aa89ad0c1b33a1eab7215a68fa4e6bc62a7
7
+ data.tar.gz: f52f6bcd3512beafac9088d795719ef492eeb3b0d51de40855cb4c5857dcea443bb1db46c637c3aa5d73fdc41af690e97974dd8134cc6831bba7c93227f666ed
data/ChangeLog.md CHANGED
@@ -1,3 +1,19 @@
1
+ # 1.0.0
2
+
3
+ ## Enhancements
4
+
5
+ * `insert_table` method accept `clustering_fields` argument.
6
+
7
+ # 1.0.0
8
+
9
+ ## Breaking Changes
10
+
11
+ * The default value of `use_legacy_sql` is now turn to false.
12
+
13
+ ## Enhancements
14
+
15
+ * Now load/query/extract/copy methods accept keyword rest argument and pass the options to the JobConfiguration properties.
16
+
1
17
  # 0.6.3
2
18
 
3
19
  ## Changes
data/lib/kura/client.rb CHANGED
@@ -199,8 +199,9 @@ module Kura
199
199
  def insert_table(dataset_id, table_id, project_id: @default_project_id, expiration_time: nil,
200
200
  friendly_name: nil, schema: nil, description: nil,
201
201
  query: nil, external_data_configuration: nil,
202
- use_legacy_sql: true,
202
+ use_legacy_sql: false,
203
203
  time_partitioning: nil,
204
+ clustering_fields: [],
204
205
  &blk)
205
206
  if expiration_time
206
207
  expiration_time = (expiration_time.to_f * 1000.0).to_i
@@ -222,6 +223,9 @@ module Kura
222
223
  if time_partitioning
223
224
  table.time_partitioning = Google::Apis::BigqueryV2::TimePartitioning.new(**time_partitioning)
224
225
  end
226
+ if clustering_fields and clustering_fields.size > 0
227
+ table.clustering = Google::Apis::BigqueryV2::Clustering.new(fields: clustering_fields)
228
+ end
225
229
  @api.insert_table(project_id, dataset_id, table, &blk)
226
230
  rescue
227
231
  process_error($!)
@@ -408,7 +412,7 @@ module Kura
408
412
  priority: "INTERACTIVE",
409
413
  use_query_cache: true,
410
414
  user_defined_function_resources: nil,
411
- use_legacy_sql: true,
415
+ use_legacy_sql: false,
412
416
  maximum_billing_tier: nil,
413
417
  maximum_bytes_billed: nil,
414
418
  external_data_configuration: nil,
@@ -417,6 +421,7 @@ module Kura
417
421
  job_id: nil,
418
422
  wait: nil,
419
423
  dry_run: false,
424
+ **kwrest,
420
425
  &blk)
421
426
  configuration = Google::Apis::BigqueryV2::JobConfiguration.new(
422
427
  query: Google::Apis::BigqueryV2::JobConfigurationQuery.new(
@@ -457,6 +462,13 @@ module Kura
457
462
  if external_data_configuration
458
463
  configuration.query.table_definitions = external_data_configuration
459
464
  end
465
+ kwrest.each do |kw, opt|
466
+ if configuration.query.respond_to?("#{kw}=")
467
+ configuration.query.__send__("#{kw}=", opt)
468
+ else
469
+ raise ArgumentError, "Unknown keyword argument for Kura::Client#query: #{kw}"
470
+ end
471
+ end
460
472
  insert_job(configuration, wait: wait, job_id: job_id, project_id: job_project_id, &blk)
461
473
  end
462
474
 
@@ -507,6 +519,7 @@ module Kura
507
519
  job_id: nil,
508
520
  file: nil, wait: nil,
509
521
  dry_run: false,
522
+ **kwrest,
510
523
  &blk)
511
524
  write_disposition = mode_to_write_disposition(mode)
512
525
  source_uris = [source_uris] if source_uris.is_a?(String)
@@ -553,6 +566,13 @@ module Kura
553
566
  unless file
554
567
  configuration.load.source_uris = source_uris
555
568
  end
569
+ kwrest.each do |kw, opt|
570
+ if configuration.load.respond_to?("#{kw}=")
571
+ configuration.load.__send__("#{kw}=", opt)
572
+ else
573
+ raise ArgumentError, "Unknown keyword argument for Kura::Client#load: #{kw}"
574
+ end
575
+ end
556
576
  insert_job(configuration, media: file, wait: wait, job_id: job_id, project_id: job_project_id, &blk)
557
577
  end
558
578
 
@@ -566,6 +586,7 @@ module Kura
566
586
  job_id: nil,
567
587
  wait: nil,
568
588
  dry_run: false,
589
+ **kwrest,
569
590
  &blk)
570
591
  dest_uris = [ dest_uris ] if dest_uris.is_a?(String)
571
592
  configuration = Google::Apis::BigqueryV2::JobConfiguration.new(
@@ -588,6 +609,13 @@ module Kura
588
609
  configuration.extract.field_delimiter = field_delimiter
589
610
  configuration.extract.print_header = normalize_parameter(print_header)
590
611
  end
612
+ kwrest.each do |kw, opt|
613
+ if configuration.extract.respond_to?("#{kw}=")
614
+ configuration.extract.__send__("#{kw}=", opt)
615
+ else
616
+ raise ArgumentError, "Unknown keyword argument for Kura::Client#extract: #{kw}"
617
+ end
618
+ end
591
619
  insert_job(configuration, wait: wait, job_id: job_id, project_id: job_project_id, &blk)
592
620
  end
593
621
 
@@ -599,6 +627,7 @@ module Kura
599
627
  job_id: nil,
600
628
  wait: nil,
601
629
  dry_run: false,
630
+ **kwrest,
602
631
  &blk)
603
632
  write_disposition = mode_to_write_disposition(mode)
604
633
  configuration = Google::Apis::BigqueryV2::JobConfiguration.new(
@@ -620,6 +649,13 @@ module Kura
620
649
  configuration.dry_run = true
621
650
  wait = nil
622
651
  end
652
+ kwrest.each do |kw, opt|
653
+ if configuration.copy.respond_to?("#{kw}=")
654
+ configuration.copy.__send__("#{kw}=", opt)
655
+ else
656
+ raise ArgumentError, "Unknown keyword argument for Kura::Client#copy: #{kw}"
657
+ end
658
+ end
623
659
  insert_job(configuration, wait: wait, job_id: job_id, project_id: job_project_id, &blk)
624
660
  end
625
661
 
data/lib/kura/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kura
2
- VERSION = "0.6.3"
2
+ VERSION = "1.0.1"
3
3
  end
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.6.3
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chikanaga Tomoyuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-04 00:00:00.000000000 Z
11
+ date: 2023-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-apis-bigquery_v2
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  requirements: []
151
- rubygems_version: 3.2.15
151
+ rubygems_version: 3.3.26
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Interface to BigQuery API v2.