google-cloud-bigquery 1.19.0 → 1.20.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65c8bae8c365c4fde7d54e75abe9c15aa4eba702b2e6300371843bc97bbc27f7
4
- data.tar.gz: 5457cacd3331a717f63b0d71b907aa5e68702256118cd41d16f90be672f187e4
3
+ metadata.gz: 3d887921d9819a9fae907aa50bb5f7ca805514b7911edeee335d7caa82bcca8a
4
+ data.tar.gz: 45abf44f843328b5e9d0f7dad0780735dfb12b5766ded4b12dc35c0a5f949555
5
5
  SHA512:
6
- metadata.gz: b7f0438c001bccc0854ecf13b81909c056635a50489d074c8d91beb13ba3f5e00826663b20371ef7b0669a6cfcb3ee058da8eefc6ffcfd410e9da18d1dd82167
7
- data.tar.gz: 05f8d06e52e06625655730e0c31ae57a8b6bec5c771809d73814413db90122477b143d494d0e8236f43782766673a0f0230b48480f9ce0cddb125b55065cc68a
6
+ metadata.gz: 754714cfca94ca584b8900bf5dbe483693594d873f0344051fa71b41dfcacec8a642720d34939db881ba9e9f2cf7ca6baeb4a3a98c67430e046062bcc91d5b06
7
+ data.tar.gz: 24b37f4222cd43dee18edef1150db12cdc0d25e686b70ee1429f474b6670a30e5cacb26b809fc484be6cb55e9f9a63ef693d1acb0c44902a20e1cb633b1f2274
@@ -1,5 +1,14 @@
1
1
  # Release History
2
2
 
3
+ ### 1.20.0 / 2020-03-11
4
+
5
+ #### Features
6
+
7
+ * Add Range Partitioning
8
+ * Add range partitioning methods to Table and Table::Updater
9
+ * Add range partitioning methods to LoadJob
10
+ * Add range partitioning methods to QueryJob
11
+
3
12
  ### 1.19.0 / 2020-02-11
4
13
 
5
14
  #### Features
@@ -555,6 +555,40 @@ module Google
555
555
  # end
556
556
  # end
557
557
  #
558
+ # @example With time partitioning and clustering.
559
+ # require "google/cloud/bigquery"
560
+ #
561
+ # bigquery = Google::Cloud::Bigquery.new
562
+ # dataset = bigquery.dataset "my_dataset"
563
+ #
564
+ # table = dataset.create_table "my_table" do |t|
565
+ # t.schema do |schema|
566
+ # schema.timestamp "dob", mode: :required
567
+ # schema.string "first_name", mode: :required
568
+ # schema.string "last_name", mode: :required
569
+ # end
570
+ # t.time_partitioning_type = "DAY"
571
+ # t.time_partitioning_field = "dob"
572
+ # t.clustering_fields = ["last_name", "first_name"]
573
+ # end
574
+ #
575
+ # @example With range partitioning.
576
+ # require "google/cloud/bigquery"
577
+ #
578
+ # bigquery = Google::Cloud::Bigquery.new
579
+ # dataset = bigquery.dataset "my_dataset"
580
+ #
581
+ # table = dataset.create_table "my_table" do |t|
582
+ # t.schema do |schema|
583
+ # schema.integer "my_table_id", mode: :required
584
+ # schema.string "my_table_data", mode: :required
585
+ # end
586
+ # t.range_partitioning_field = "my_table_id"
587
+ # t.range_partitioning_start = 0
588
+ # t.range_partitioning_interval = 10
589
+ # t.range_partitioning_end = 100
590
+ # end
591
+ #
558
592
  # @!group Table
559
593
  #
560
594
  def create_table table_id, name: nil, description: nil
@@ -348,7 +348,71 @@ module Google
348
348
  end
349
349
 
350
350
  ###
351
- # Checks if the destination table will be time-partitioned. See
351
+ # Checks if the destination table will be range partitioned. See [Creating and using integer range partitioned
352
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
353
+ #
354
+ # @return [Boolean] `true` when the table is range partitioned, or `false` otherwise.
355
+ #
356
+ # @!group Attributes
357
+ #
358
+ def range_partitioning?
359
+ !@gapi.configuration.load.range_partitioning.nil?
360
+ end
361
+
362
+ ###
363
+ # The field on which the destination table will be range partitioned, if any. The field must be a
364
+ # top-level `NULLABLE/REQUIRED` field. The only supported type is `INTEGER/INT64`. See
365
+ # [Creating and using integer range partitioned
366
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
367
+ #
368
+ # @return [String, nil] The partition field, if a field was configured, or `nil` if not range partitioned.
369
+ #
370
+ # @!group Attributes
371
+ #
372
+ def range_partitioning_field
373
+ @gapi.configuration.load.range_partitioning.field if range_partitioning?
374
+ end
375
+
376
+ ###
377
+ # The start of range partitioning, inclusive. See [Creating and using integer range partitioned
378
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
379
+ #
380
+ # @return [Integer, nil] The start of range partitioning, inclusive, or `nil` if not range partitioned.
381
+ #
382
+ # @!group Attributes
383
+ #
384
+ def range_partitioning_start
385
+ @gapi.configuration.load.range_partitioning.range.start if range_partitioning?
386
+ end
387
+
388
+ ###
389
+ # The width of each interval. See [Creating and using integer range partitioned
390
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
391
+ #
392
+ # @return [Integer, nil] The width of each interval, for data in range partitions, or `nil` if not range
393
+ # partitioned.
394
+ #
395
+ # @!group Attributes
396
+ #
397
+ def range_partitioning_interval
398
+ return nil unless range_partitioning?
399
+ @gapi.configuration.load.range_partitioning.range.interval
400
+ end
401
+
402
+ ###
403
+ # The end of range partitioning, exclusive. See [Creating and using integer range partitioned
404
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
405
+ #
406
+ # @return [Integer, nil] The end of range partitioning, exclusive, or `nil` if not range partitioned.
407
+ #
408
+ # @!group Attributes
409
+ #
410
+ def range_partitioning_end
411
+ @gapi.configuration.load.range_partitioning.range.end if range_partitioning?
412
+ end
413
+
414
+ ###
415
+ # Checks if the destination table will be time partitioned. See
352
416
  # [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
353
417
  #
354
418
  # @return [Boolean, nil] `true` when the table will be time-partitioned,
@@ -361,10 +425,10 @@ module Google
361
425
  end
362
426
 
363
427
  ###
364
- # The period for which the destination table will be partitioned, if
428
+ # The period for which the destination table will be time partitioned, if
365
429
  # any. See [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
366
430
  #
367
- # @return [String, nil] The partition type. Currently the only supported
431
+ # @return [String, nil] The time partition type. Currently the only supported
368
432
  # value is "DAY", or `nil` if not present.
369
433
  #
370
434
  # @!group Attributes
@@ -374,13 +438,13 @@ module Google
374
438
  end
375
439
 
376
440
  ###
377
- # The field on which the destination table will be partitioned, if any.
378
- # If not set, the destination table will be partitioned by pseudo column
379
- # `_PARTITIONTIME`; if set, the table will be partitioned by this field.
441
+ # The field on which the destination table will be time partitioned, if any.
442
+ # If not set, the destination table will be time partitioned by pseudo column
443
+ # `_PARTITIONTIME`; if set, the table will be time partitioned by this field.
380
444
  # See [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
381
445
  #
382
- # @return [String, nil] The partition field, if a field was configured.
383
- # `nil` if not partitioned or not set (partitioned by pseudo column
446
+ # @return [String, nil] The time partition field, if a field was configured.
447
+ # `nil` if not time partitioned or not set (partitioned by pseudo column
384
448
  # '_PARTITIONTIME').
385
449
  #
386
450
  # @!group Attributes
@@ -390,12 +454,12 @@ module Google
390
454
  end
391
455
 
392
456
  ###
393
- # The expiration for the destination table partitions, if any, in
457
+ # The expiration for the destination table time partitions, if any, in
394
458
  # seconds. See [Partitioned
395
459
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
396
460
  #
397
461
  # @return [Integer, nil] The expiration time, in seconds, for data in
398
- # partitions, or `nil` if not present.
462
+ # time partitions, or `nil` if not present.
399
463
  #
400
464
  # @!group Attributes
401
465
  #
@@ -408,11 +472,11 @@ module Google
408
472
 
409
473
  ###
410
474
  # If set to true, queries over the destination table will require a
411
- # partition filter that can be used for partition elimination to be
475
+ # time partition filter that can be used for partition elimination to be
412
476
  # specified. See [Partitioned
413
477
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
414
478
  #
415
- # @return [Boolean] `true` when a partition filter will be required,
479
+ # @return [Boolean] `true` when a time partition filter will be required,
416
480
  # or `false` otherwise.
417
481
  #
418
482
  # @!group Attributes
@@ -1253,14 +1317,180 @@ module Google
1253
1317
  end
1254
1318
 
1255
1319
  ##
1256
- # Sets the partitioning for the destination table. See [Partitioned
1320
+ # Sets the field on which to range partition the table. See [Creating and using integer range partitioned
1321
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
1322
+ #
1323
+ # See {#range_partitioning_start=}, {#range_partitioning_interval=} and {#range_partitioning_end=}.
1324
+ #
1325
+ # You can only set range partitioning when creating a table. BigQuery does not allow you to change
1326
+ # partitioning on an existing table.
1327
+ #
1328
+ # @param [String] field The range partition field. the destination table is partitioned by this
1329
+ # field. The field must be a top-level `NULLABLE/REQUIRED` field. The only supported
1330
+ # type is `INTEGER/INT64`.
1331
+ #
1332
+ # @example
1333
+ # require "google/cloud/bigquery"
1334
+ #
1335
+ # bigquery = Google::Cloud::Bigquery.new
1336
+ # dataset = bigquery.dataset "my_dataset"
1337
+ #
1338
+ # gs_url = "gs://my-bucket/file-name.csv"
1339
+ # load_job = dataset.load_job "my_new_table", gs_url do |job|
1340
+ # job.schema do |schema|
1341
+ # schema.integer "my_table_id", mode: :required
1342
+ # schema.string "my_table_data", mode: :required
1343
+ # end
1344
+ # job.range_partitioning_field = "my_table_id"
1345
+ # job.range_partitioning_start = 0
1346
+ # job.range_partitioning_interval = 10
1347
+ # job.range_partitioning_end = 100
1348
+ # end
1349
+ #
1350
+ # load_job.wait_until_done!
1351
+ # load_job.done? #=> true
1352
+ #
1353
+ # @!group Attributes
1354
+ #
1355
+ def range_partitioning_field= field
1356
+ @gapi.configuration.load.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
1357
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
1358
+ )
1359
+ @gapi.configuration.load.range_partitioning.field = field
1360
+ end
1361
+
1362
+ ##
1363
+ # Sets the start of range partitioning, inclusive, for the destination table. See [Creating and using integer
1364
+ # range partitioned tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
1365
+ #
1366
+ # You can only set range partitioning when creating a table. BigQuery does not allow you to change
1367
+ # partitioning on an existing table.
1368
+ #
1369
+ # See {#range_partitioning_field=}, {#range_partitioning_interval=} and {#range_partitioning_end=}.
1370
+ #
1371
+ # @param [Integer] range_start The start of range partitioning, inclusive.
1372
+ #
1373
+ # @example
1374
+ # require "google/cloud/bigquery"
1375
+ #
1376
+ # bigquery = Google::Cloud::Bigquery.new
1377
+ # dataset = bigquery.dataset "my_dataset"
1378
+ #
1379
+ # gs_url = "gs://my-bucket/file-name.csv"
1380
+ # load_job = dataset.load_job "my_new_table", gs_url do |job|
1381
+ # job.schema do |schema|
1382
+ # schema.integer "my_table_id", mode: :required
1383
+ # schema.string "my_table_data", mode: :required
1384
+ # end
1385
+ # job.range_partitioning_field = "my_table_id"
1386
+ # job.range_partitioning_start = 0
1387
+ # job.range_partitioning_interval = 10
1388
+ # job.range_partitioning_end = 100
1389
+ # end
1390
+ #
1391
+ # load_job.wait_until_done!
1392
+ # load_job.done? #=> true
1393
+ #
1394
+ # @!group Attributes
1395
+ #
1396
+ def range_partitioning_start= range_start
1397
+ @gapi.configuration.load.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
1398
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
1399
+ )
1400
+ @gapi.configuration.load.range_partitioning.range.start = range_start
1401
+ end
1402
+
1403
+ ##
1404
+ # Sets width of each interval for data in range partitions. See [Creating and using integer range partitioned
1405
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
1406
+ #
1407
+ # You can only set range partitioning when creating a table. BigQuery does not allow you to change
1408
+ # partitioning on an existing table.
1409
+ #
1410
+ # See {#range_partitioning_field=}, {#range_partitioning_start=} and {#range_partitioning_end=}.
1411
+ #
1412
+ # @param [Integer] range_interval The width of each interval, for data in partitions.
1413
+ #
1414
+ # @example
1415
+ # require "google/cloud/bigquery"
1416
+ #
1417
+ # bigquery = Google::Cloud::Bigquery.new
1418
+ # dataset = bigquery.dataset "my_dataset"
1419
+ #
1420
+ # gs_url = "gs://my-bucket/file-name.csv"
1421
+ # load_job = dataset.load_job "my_new_table", gs_url do |job|
1422
+ # job.schema do |schema|
1423
+ # schema.integer "my_table_id", mode: :required
1424
+ # schema.string "my_table_data", mode: :required
1425
+ # end
1426
+ # job.range_partitioning_field = "my_table_id"
1427
+ # job.range_partitioning_start = 0
1428
+ # job.range_partitioning_interval = 10
1429
+ # job.range_partitioning_end = 100
1430
+ # end
1431
+ #
1432
+ # load_job.wait_until_done!
1433
+ # load_job.done? #=> true
1434
+ #
1435
+ # @!group Attributes
1436
+ #
1437
+ def range_partitioning_interval= range_interval
1438
+ @gapi.configuration.load.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
1439
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
1440
+ )
1441
+ @gapi.configuration.load.range_partitioning.range.interval = range_interval
1442
+ end
1443
+
1444
+ ##
1445
+ # Sets the end of range partitioning, exclusive, for the destination table. See [Creating and using integer
1446
+ # range partitioned tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
1447
+ #
1448
+ # You can only set range partitioning when creating a table. BigQuery does not allow you to change
1449
+ # partitioning on an existing table.
1450
+ #
1451
+ # See {#range_partitioning_start=}, {#range_partitioning_interval=} and {#range_partitioning_field=}.
1452
+ #
1453
+ # @param [Integer] range_end The end of range partitioning, exclusive.
1454
+ #
1455
+ # @example
1456
+ # require "google/cloud/bigquery"
1457
+ #
1458
+ # bigquery = Google::Cloud::Bigquery.new
1459
+ # dataset = bigquery.dataset "my_dataset"
1460
+ #
1461
+ # gs_url = "gs://my-bucket/file-name.csv"
1462
+ # load_job = dataset.load_job "my_new_table", gs_url do |job|
1463
+ # job.schema do |schema|
1464
+ # schema.integer "my_table_id", mode: :required
1465
+ # schema.string "my_table_data", mode: :required
1466
+ # end
1467
+ # job.range_partitioning_field = "my_table_id"
1468
+ # job.range_partitioning_start = 0
1469
+ # job.range_partitioning_interval = 10
1470
+ # job.range_partitioning_end = 100
1471
+ # end
1472
+ #
1473
+ # load_job.wait_until_done!
1474
+ # load_job.done? #=> true
1475
+ #
1476
+ # @!group Attributes
1477
+ #
1478
+ def range_partitioning_end= range_end
1479
+ @gapi.configuration.load.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
1480
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
1481
+ )
1482
+ @gapi.configuration.load.range_partitioning.range.end = range_end
1483
+ end
1484
+
1485
+ ##
1486
+ # Sets the time partitioning for the destination table. See [Partitioned
1257
1487
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
1258
1488
  #
1259
- # You can only set the partitioning field while creating a table.
1489
+ # You can only set the time partitioning field while creating a table.
1260
1490
  # BigQuery does not allow you to change partitioning on an existing
1261
1491
  # table.
1262
1492
  #
1263
- # @param [String] type The partition type. Currently the only
1493
+ # @param [String] type The time partition type. Currently the only
1264
1494
  # supported value is "DAY".
1265
1495
  #
1266
1496
  # @example
@@ -1285,20 +1515,20 @@ module Google
1285
1515
  end
1286
1516
 
1287
1517
  ##
1288
- # Sets the field on which to partition the destination table. If not
1289
- # set, the destination table is partitioned by pseudo column
1290
- # `_PARTITIONTIME`; if set, the table is partitioned by this field.
1518
+ # Sets the field on which to time partition the destination table. If not
1519
+ # set, the destination table is time partitioned by pseudo column
1520
+ # `_PARTITIONTIME`; if set, the table is time partitioned by this field.
1291
1521
  # See [Partitioned
1292
1522
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
1293
1523
  #
1294
- # The destination table must also be partitioned. See
1524
+ # The destination table must also be time partitioned. See
1295
1525
  # {#time_partitioning_type=}.
1296
1526
  #
1297
- # You can only set the partitioning field while creating a table.
1527
+ # You can only set the time partitioning field while creating a table.
1298
1528
  # BigQuery does not allow you to change partitioning on an existing
1299
1529
  # table.
1300
1530
  #
1301
- # @param [String] field The partition field. The field must be a
1531
+ # @param [String] field The time partition field. The field must be a
1302
1532
  # top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or
1303
1533
  # REQUIRED.
1304
1534
  #
@@ -1328,15 +1558,15 @@ module Google
1328
1558
  end
1329
1559
 
1330
1560
  ##
1331
- # Sets the partition expiration for the destination table. See
1561
+ # Sets the time partition expiration for the destination table. See
1332
1562
  # [Partitioned
1333
1563
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
1334
1564
  #
1335
- # The destination table must also be partitioned. See
1565
+ # The destination table must also be time partitioned. See
1336
1566
  # {#time_partitioning_type=}.
1337
1567
  #
1338
1568
  # @param [Integer] expiration An expiration time, in seconds,
1339
- # for data in partitions.
1569
+ # for data in time partitions.
1340
1570
  #
1341
1571
  # @example
1342
1572
  # require "google/cloud/bigquery"
@@ -1362,12 +1592,12 @@ module Google
1362
1592
 
1363
1593
  ##
1364
1594
  # If set to true, queries over the destination table will require a
1365
- # partition filter that can be used for partition elimination to be
1595
+ # time partition filter that can be used for time partition elimination to be
1366
1596
  # specified. See [Partitioned
1367
1597
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
1368
1598
  #
1369
1599
  # @param [Boolean] val Indicates if queries over the destination table
1370
- # will require a partition filter. The default value is `false`.
1600
+ # will require a time partition filter. The default value is `false`.
1371
1601
  #
1372
1602
  # @!group Attributes
1373
1603
  #
@@ -410,6 +410,69 @@ module Google
410
410
  EncryptionConfiguration.from_gapi @gapi.configuration.query.destination_encryption_configuration
411
411
  end
412
412
 
413
+ ###
414
+ # Checks if the destination table will be range partitioned. See [Creating and using integer range partitioned
415
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
416
+ #
417
+ # @return [Boolean] `true` when the table is range partitioned, or `false` otherwise.
418
+ #
419
+ # @!group Attributes
420
+ #
421
+ def range_partitioning?
422
+ !@gapi.configuration.query.range_partitioning.nil?
423
+ end
424
+
425
+ ###
426
+ # The field on which the destination table will be range partitioned, if any. The field must be a
427
+ # top-level `NULLABLE/REQUIRED` field. The only supported type is `INTEGER/INT64`. See
428
+ # [Creating and using integer range partitioned
429
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
430
+ #
431
+ # @return [String, nil] The partition field, if a field was configured, or `nil` if not range partitioned.
432
+ #
433
+ # @!group Attributes
434
+ #
435
+ def range_partitioning_field
436
+ @gapi.configuration.query.range_partitioning.field if range_partitioning?
437
+ end
438
+
439
+ ###
440
+ # The start of range partitioning, inclusive. See [Creating and using integer range partitioned
441
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
442
+ #
443
+ # @return [Integer, nil] The start of range partitioning, inclusive, or `nil` if not range partitioned.
444
+ #
445
+ # @!group Attributes
446
+ #
447
+ def range_partitioning_start
448
+ @gapi.configuration.query.range_partitioning.range.start if range_partitioning?
449
+ end
450
+
451
+ ###
452
+ # The width of each interval. See [Creating and using integer range partitioned
453
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
454
+ #
455
+ # @return [Integer, nil] The width of each interval, for data in range partitions, or `nil` if not range
456
+ # partitioned.
457
+ #
458
+ # @!group Attributes
459
+ #
460
+ def range_partitioning_interval
461
+ @gapi.configuration.query.range_partitioning.range.interval if range_partitioning?
462
+ end
463
+
464
+ ###
465
+ # The end of range partitioning, exclusive. See [Creating and using integer range partitioned
466
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
467
+ #
468
+ # @return [Integer, nil] The end of range partitioning, exclusive, or `nil` if not range partitioned.
469
+ #
470
+ # @!group Attributes
471
+ #
472
+ def range_partitioning_end
473
+ @gapi.configuration.query.range_partitioning.range.end if range_partitioning?
474
+ end
475
+
413
476
  ###
414
477
  # Checks if the destination table will be time-partitioned. See
415
478
  # [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
@@ -1028,6 +1091,164 @@ module Google
1028
1091
  @gapi.configuration.query.update! destination_encryption_configuration: val.to_gapi
1029
1092
  end
1030
1093
 
1094
+ ##
1095
+ # Sets the field on which to range partition the table. See [Creating and using integer range partitioned
1096
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
1097
+ #
1098
+ # See {#range_partitioning_start=}, {#range_partitioning_interval=} and {#range_partitioning_end=}.
1099
+ #
1100
+ # You can only set range partitioning when creating a table. BigQuery does not allow you to change
1101
+ # partitioning on an existing table.
1102
+ #
1103
+ # @param [String] field The range partition field. the destination table is partitioned by this
1104
+ # field. The field must be a top-level `NULLABLE/REQUIRED` field. The only supported
1105
+ # type is `INTEGER/INT64`.
1106
+ #
1107
+ # @example
1108
+ # require "google/cloud/bigquery"
1109
+ #
1110
+ # bigquery = Google::Cloud::Bigquery.new
1111
+ # dataset = bigquery.dataset "my_dataset"
1112
+ # destination_table = dataset.table "my_destination_table",
1113
+ # skip_lookup: true
1114
+ #
1115
+ # job = bigquery.query_job "SELECT num FROM UNNEST(GENERATE_ARRAY(0, 99)) AS num" do |job|
1116
+ # job.table = destination_table
1117
+ # job.range_partitioning_field = "num"
1118
+ # job.range_partitioning_start = 0
1119
+ # job.range_partitioning_interval = 10
1120
+ # job.range_partitioning_end = 100
1121
+ # end
1122
+ #
1123
+ # job.wait_until_done!
1124
+ # job.done? #=> true
1125
+ #
1126
+ # @!group Attributes
1127
+ #
1128
+ def range_partitioning_field= field
1129
+ @gapi.configuration.query.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
1130
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
1131
+ )
1132
+ @gapi.configuration.query.range_partitioning.field = field
1133
+ end
1134
+
1135
+ ##
1136
+ # Sets the start of range partitioning, inclusive, for the destination table. See [Creating and using integer
1137
+ # range partitioned tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
1138
+ #
1139
+ # You can only set range partitioning when creating a table. BigQuery does not allow you to change
1140
+ # partitioning on an existing table.
1141
+ #
1142
+ # See {#range_partitioning_field=}, {#range_partitioning_interval=} and {#range_partitioning_end=}.
1143
+ #
1144
+ # @param [Integer] range_start The start of range partitioning, inclusive.
1145
+ #
1146
+ # @example
1147
+ # require "google/cloud/bigquery"
1148
+ #
1149
+ # bigquery = Google::Cloud::Bigquery.new
1150
+ # dataset = bigquery.dataset "my_dataset"
1151
+ # destination_table = dataset.table "my_destination_table",
1152
+ # skip_lookup: true
1153
+ #
1154
+ # job = bigquery.query_job "SELECT num FROM UNNEST(GENERATE_ARRAY(0, 99)) AS num" do |job|
1155
+ # job.table = destination_table
1156
+ # job.range_partitioning_field = "num"
1157
+ # job.range_partitioning_start = 0
1158
+ # job.range_partitioning_interval = 10
1159
+ # job.range_partitioning_end = 100
1160
+ # end
1161
+ #
1162
+ # job.wait_until_done!
1163
+ # job.done? #=> true
1164
+ #
1165
+ # @!group Attributes
1166
+ #
1167
+ def range_partitioning_start= range_start
1168
+ @gapi.configuration.query.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
1169
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
1170
+ )
1171
+ @gapi.configuration.query.range_partitioning.range.start = range_start
1172
+ end
1173
+
1174
+ ##
1175
+ # Sets width of each interval for data in range partitions. See [Creating and using integer range partitioned
1176
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
1177
+ #
1178
+ # You can only set range partitioning when creating a table. BigQuery does not allow you to change
1179
+ # partitioning on an existing table.
1180
+ #
1181
+ # See {#range_partitioning_field=}, {#range_partitioning_start=} and {#range_partitioning_end=}.
1182
+ #
1183
+ # @param [Integer] range_interval The width of each interval, for data in partitions.
1184
+ #
1185
+ # @example
1186
+ # require "google/cloud/bigquery"
1187
+ #
1188
+ # bigquery = Google::Cloud::Bigquery.new
1189
+ # dataset = bigquery.dataset "my_dataset"
1190
+ # destination_table = dataset.table "my_destination_table",
1191
+ # skip_lookup: true
1192
+ #
1193
+ # job = bigquery.query_job "SELECT num FROM UNNEST(GENERATE_ARRAY(0, 99)) AS num" do |job|
1194
+ # job.table = destination_table
1195
+ # job.range_partitioning_field = "num"
1196
+ # job.range_partitioning_start = 0
1197
+ # job.range_partitioning_interval = 10
1198
+ # job.range_partitioning_end = 100
1199
+ # end
1200
+ #
1201
+ # job.wait_until_done!
1202
+ # job.done? #=> true
1203
+ #
1204
+ # @!group Attributes
1205
+ #
1206
+ def range_partitioning_interval= range_interval
1207
+ @gapi.configuration.query.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
1208
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
1209
+ )
1210
+ @gapi.configuration.query.range_partitioning.range.interval = range_interval
1211
+ end
1212
+
1213
+ ##
1214
+ # Sets the end of range partitioning, exclusive, for the destination table. See [Creating and using integer
1215
+ # range partitioned tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
1216
+ #
1217
+ # You can only set range partitioning when creating a table. BigQuery does not allow you to change
1218
+ # partitioning on an existing table.
1219
+ #
1220
+ # See {#range_partitioning_start=}, {#range_partitioning_interval=} and {#range_partitioning_field=}.
1221
+ #
1222
+ # @param [Integer] range_end The end of range partitioning, exclusive.
1223
+ #
1224
+ # @example
1225
+ # require "google/cloud/bigquery"
1226
+ #
1227
+ # bigquery = Google::Cloud::Bigquery.new
1228
+ # dataset = bigquery.dataset "my_dataset"
1229
+ # destination_table = dataset.table "my_destination_table",
1230
+ # skip_lookup: true
1231
+ #
1232
+ # job = bigquery.query_job "SELECT num FROM UNNEST(GENERATE_ARRAY(0, 99)) AS num" do |job|
1233
+ # job.table = destination_table
1234
+ # job.range_partitioning_field = "num"
1235
+ # job.range_partitioning_start = 0
1236
+ # job.range_partitioning_interval = 10
1237
+ # job.range_partitioning_end = 100
1238
+ # end
1239
+ #
1240
+ # job.wait_until_done!
1241
+ # job.done? #=> true
1242
+ #
1243
+ # @!group Attributes
1244
+ #
1245
+ def range_partitioning_end= range_end
1246
+ @gapi.configuration.query.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
1247
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
1248
+ )
1249
+ @gapi.configuration.query.range_partitioning.range.end = range_end
1250
+ end
1251
+
1031
1252
  ##
1032
1253
  # Sets the partitioning for the destination table. See [Partitioned
1033
1254
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
@@ -232,8 +232,8 @@ module Google
232
232
  #
233
233
  # bigquery = Google::Cloud::Bigquery.new
234
234
  # dataset = bigquery.dataset "my_dataset"
235
- # table = dataset.table "my_table" do |table|
236
- # table.schema.load File.read("path/to/schema.json")
235
+ # table = dataset.table "my_table" do |t|
236
+ # t.schema.load File.read("path/to/schema.json")
237
237
  # end
238
238
  #
239
239
  def load source
@@ -155,10 +155,87 @@ module Google
155
155
  end
156
156
 
157
157
  ###
158
- # Checks if the table is time-partitioned. See [Partitioned
158
+ # Checks if the table is range partitioned. See [Creating and using integer range partitioned
159
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
160
+ #
161
+ # @return [Boolean, nil] `true` when the table is range partitioned, or
162
+ # `false` otherwise, if the object is a resource (see {#resource?});
163
+ # `nil` if the object is a reference (see {#reference?}).
164
+ #
165
+ # @!group Attributes
166
+ #
167
+ def range_partitioning?
168
+ return nil if reference?
169
+ !@gapi.range_partitioning.nil?
170
+ end
171
+
172
+ ###
173
+ # The field on which the table is range partitioned, if any. The field must be a top-level `NULLABLE/REQUIRED`
174
+ # field. The only supported type is `INTEGER/INT64`. See [Creating and using integer range partitioned
175
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
176
+ #
177
+ # @return [Integer, nil] The range partition field, or `nil` if not range partitioned or the object is a
178
+ # reference (see {#reference?}).
179
+ #
180
+ # @!group Attributes
181
+ #
182
+ def range_partitioning_field
183
+ return nil if reference?
184
+ ensure_full_data!
185
+ @gapi.range_partitioning.field if range_partitioning?
186
+ end
187
+
188
+ ###
189
+ # The start of range partitioning, inclusive. See [Creating and using integer range partitioned
190
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
191
+ #
192
+ # @return [Integer, nil] The start of range partitioning, inclusive, or `nil` if not range partitioned or the
193
+ # object is a reference (see {#reference?}).
194
+ #
195
+ # @!group Attributes
196
+ #
197
+ def range_partitioning_start
198
+ return nil if reference?
199
+ ensure_full_data!
200
+ @gapi.range_partitioning.range.start if range_partitioning?
201
+ end
202
+
203
+ ###
204
+ # The width of each interval. See [Creating and using integer range partitioned
205
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
206
+ #
207
+ # @return [Integer, nil] The width of each interval, for data in range partitions, or `nil` if not range
208
+ # partitioned or the object is a reference (see {#reference?}).
209
+ #
210
+ # @!group Attributes
211
+ #
212
+ def range_partitioning_interval
213
+ return nil if reference?
214
+ ensure_full_data!
215
+ return nil unless range_partitioning?
216
+ @gapi.range_partitioning.range.interval
217
+ end
218
+
219
+ ###
220
+ # The end of range partitioning, exclusive. See [Creating and using integer range partitioned
221
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
222
+ #
223
+ # @return [Integer, nil] The end of range partitioning, exclusive, or `nil` if not range partitioned or the
224
+ # object is a reference (see {#reference?}).
225
+ #
226
+ # @!group Attributes
227
+ #
228
+ def range_partitioning_end
229
+ return nil if reference?
230
+ ensure_full_data!
231
+ @gapi.range_partitioning.range.end if range_partitioning?
232
+ end
233
+
234
+ ###
235
+ # Checks if the table is time partitioned. See [Partitioned
159
236
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
160
237
  #
161
- # @return [Boolean, nil] `true` when the table is time-partitioned, or
238
+ # @return [Boolean, nil] `true` when the table is time partitioned, or
162
239
  # `false` otherwise, if the object is a resource (see {#resource?});
163
240
  # `nil` if the object is a reference (see {#reference?}).
164
241
  #
@@ -170,10 +247,10 @@ module Google
170
247
  end
171
248
 
172
249
  ###
173
- # The period for which the table is partitioned, if any. See
250
+ # The period for which the table is time partitioned, if any. See
174
251
  # [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
175
252
  #
176
- # @return [String, nil] The partition type. Currently the only supported
253
+ # @return [String, nil] The time partition type. Currently the only supported
177
254
  # value is "DAY", or `nil` if the object is a reference (see
178
255
  # {#reference?}).
179
256
  #
@@ -186,14 +263,14 @@ module Google
186
263
  end
187
264
 
188
265
  ##
189
- # Sets the partitioning for the table. See [Partitioned
266
+ # Sets the time partitioning type for the table. See [Partitioned
190
267
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
191
268
  #
192
- # You can only set partitioning when creating a table as in
193
- # the example below. BigQuery does not allow you to change partitioning
269
+ # You can only set time partitioning when creating a table as in
270
+ # the example below. BigQuery does not allow you to change time partitioning
194
271
  # on an existing table.
195
272
  #
196
- # @param [String] type The partition type. Currently the only
273
+ # @param [String] type The time partition type. Currently the only
197
274
  # supported value is "DAY".
198
275
  #
199
276
  # @example
@@ -201,8 +278,12 @@ module Google
201
278
  #
202
279
  # bigquery = Google::Cloud::Bigquery.new
203
280
  # dataset = bigquery.dataset "my_dataset"
204
- # table = dataset.create_table "my_table" do |table|
205
- # table.time_partitioning_type = "DAY"
281
+ # table = dataset.create_table "my_table" do |t|
282
+ # t.schema do |schema|
283
+ # schema.timestamp "dob", mode: :required
284
+ # end
285
+ # t.time_partitioning_type = "DAY"
286
+ # t.time_partitioning_field = "dob"
206
287
  # end
207
288
  #
208
289
  # @!group Attributes
@@ -215,13 +296,13 @@ module Google
215
296
  end
216
297
 
217
298
  ###
218
- # The field on which the table is partitioned, if any. If not
219
- # set, the destination table is partitioned by pseudo column
220
- # `_PARTITIONTIME`; if set, the table is partitioned by this field. See
299
+ # The field on which the table is time partitioned, if any. If not
300
+ # set, the destination table is time partitioned by pseudo column
301
+ # `_PARTITIONTIME`; if set, the table is time partitioned by this field. See
221
302
  # [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
222
303
  #
223
- # @return [String, nil] The partition field, if a field was configured.
224
- # `nil` if not partitioned, not set (partitioned by pseudo column
304
+ # @return [String, nil] The time partition field, if a field was configured.
305
+ # `nil` if not time partitioned, not set (time partitioned by pseudo column
225
306
  # '_PARTITIONTIME') or the object is a reference (see {#reference?}).
226
307
  #
227
308
  # @!group Attributes
@@ -233,19 +314,19 @@ module Google
233
314
  end
234
315
 
235
316
  ##
236
- # Sets the field on which to partition the table. If not
237
- # set, the destination table is partitioned by pseudo column
238
- # `_PARTITIONTIME`; if set, the table is partitioned by this field. See
317
+ # Sets the field on which to time partition the table. If not
318
+ # set, the destination table is time partitioned by pseudo column
319
+ # `_PARTITIONTIME`; if set, the table is time partitioned by this field. See
239
320
  # [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
240
- # The table must also be partitioned.
321
+ # The table must also be time partitioned.
241
322
  #
242
323
  # See {Table#time_partitioning_type=}.
243
324
  #
244
- # You can only set the partitioning field while creating a table as in
245
- # the example below. BigQuery does not allow you to change partitioning
325
+ # You can only set the time partitioning field while creating a table as in
326
+ # the example below. BigQuery does not allow you to change time partitioning
246
327
  # on an existing table.
247
328
  #
248
- # @param [String] field The partition field. The field must be a
329
+ # @param [String] field The time partition field. The field must be a
249
330
  # top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or
250
331
  # REQUIRED.
251
332
  #
@@ -254,12 +335,12 @@ module Google
254
335
  #
255
336
  # bigquery = Google::Cloud::Bigquery.new
256
337
  # dataset = bigquery.dataset "my_dataset"
257
- # table = dataset.create_table "my_table" do |table|
258
- # table.time_partitioning_type = "DAY"
259
- # table.time_partitioning_field = "dob"
260
- # table.schema do |schema|
338
+ # table = dataset.create_table "my_table" do |t|
339
+ # t.schema do |schema|
261
340
  # schema.timestamp "dob", mode: :required
262
341
  # end
342
+ # t.time_partitioning_type = "DAY"
343
+ # t.time_partitioning_field = "dob"
263
344
  # end
264
345
  #
265
346
  # @!group Attributes
@@ -272,11 +353,11 @@ module Google
272
353
  end
273
354
 
274
355
  ###
275
- # The expiration for the table partitions, if any, in seconds. See
356
+ # The expiration for the time partitions, if any, in seconds. See
276
357
  # [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
277
358
  #
278
359
  # @return [Integer, nil] The expiration time, in seconds, for data in
279
- # partitions, or `nil` if not present or the object is a reference
360
+ # time partitions, or `nil` if not present or the object is a reference
280
361
  # (see {#reference?}).
281
362
  #
282
363
  # @!group Attributes
@@ -290,9 +371,9 @@ module Google
290
371
  end
291
372
 
292
373
  ##
293
- # Sets the partition expiration for the table. See [Partitioned
374
+ # Sets the time partition expiration for the table. See [Partitioned
294
375
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
295
- # The table must also be partitioned.
376
+ # The table must also be time partitioned.
296
377
  #
297
378
  # See {Table#time_partitioning_type=}.
298
379
  #
@@ -301,16 +382,20 @@ module Google
301
382
  # the update to comply with ETag-based optimistic concurrency control.
302
383
  #
303
384
  # @param [Integer] expiration An expiration time, in seconds,
304
- # for data in partitions.
385
+ # for data in time partitions.
305
386
  #
306
387
  # @example
307
388
  # require "google/cloud/bigquery"
308
389
  #
309
390
  # bigquery = Google::Cloud::Bigquery.new
310
391
  # dataset = bigquery.dataset "my_dataset"
311
- # table = dataset.create_table "my_table" do |table|
312
- # table.time_partitioning_type = "DAY"
313
- # table.time_partitioning_expiration = 86_400
392
+ # table = dataset.create_table "my_table" do |t|
393
+ # t.schema do |schema|
394
+ # schema.timestamp "dob", mode: :required
395
+ # end
396
+ # t.time_partitioning_type = "DAY"
397
+ # t.time_partitioning_field = "dob"
398
+ # t.time_partitioning_expiration = 86_400
314
399
  # end
315
400
  #
316
401
  # @!group Attributes
@@ -356,8 +441,8 @@ module Google
356
441
  #
357
442
  # bigquery = Google::Cloud::Bigquery.new
358
443
  # dataset = bigquery.dataset "my_dataset"
359
- # table = dataset.create_table "my_table" do |table|
360
- # table.require_partition_filter = true
444
+ # table = dataset.create_table "my_table" do |t|
445
+ # t.require_partition_filter = true
361
446
  # end
362
447
  #
363
448
  # @!group Attributes
@@ -387,7 +472,7 @@ module Google
387
472
 
388
473
  ###
389
474
  # One or more fields on which data should be clustered. Must be
390
- # specified with time-based partitioning, data in the table will be
475
+ # specified with time partitioning, data in the table will be
391
476
  # first partitioned and subsequently clustered. The order of the
392
477
  # returned fields determines the sort order of the data.
393
478
  #
@@ -2521,6 +2606,168 @@ module Google
2521
2606
  @schema = nil
2522
2607
  end
2523
2608
 
2609
+ ##
2610
+ # Sets the field on which to range partition the table. See [Creating and using integer range partitioned
2611
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
2612
+ #
2613
+ # See {Table::Updater#range_partitioning_start=}, {Table::Updater#range_partitioning_interval=} and
2614
+ # {Table::Updater#range_partitioning_end=}.
2615
+ #
2616
+ # You can only set range partitioning when creating a table as in the example below. BigQuery does not allow
2617
+ # you to change partitioning on an existing table.
2618
+ #
2619
+ # @param [String] field The range partition field. The table is partitioned by this
2620
+ # field. The field must be a top-level `NULLABLE/REQUIRED` field. The only supported
2621
+ # type is `INTEGER/INT64`.
2622
+ #
2623
+ # @example
2624
+ # require "google/cloud/bigquery"
2625
+ #
2626
+ # bigquery = Google::Cloud::Bigquery.new
2627
+ # dataset = bigquery.dataset "my_dataset"
2628
+ #
2629
+ # table = dataset.create_table "my_table" do |t|
2630
+ # t.schema do |schema|
2631
+ # schema.integer "my_table_id", mode: :required
2632
+ # schema.string "my_table_data", mode: :required
2633
+ # end
2634
+ # t.range_partitioning_field = "my_table_id"
2635
+ # t.range_partitioning_start = 0
2636
+ # t.range_partitioning_interval = 10
2637
+ # t.range_partitioning_end = 100
2638
+ # end
2639
+ #
2640
+ # @!group Attributes
2641
+ #
2642
+ def range_partitioning_field= field
2643
+ reload! unless resource_full?
2644
+ @gapi.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
2645
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
2646
+ )
2647
+ @gapi.range_partitioning.field = field
2648
+ patch_gapi! :range_partitioning
2649
+ end
2650
+
2651
+ ##
2652
+ # Sets the start of range partitioning, inclusive, for the table. See [Creating and using integer range
2653
+ # partitioned tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
2654
+ #
2655
+ # You can only set range partitioning when creating a table as in the example below. BigQuery does not allow
2656
+ # you to change partitioning on an existing table.
2657
+ #
2658
+ # See {Table::Updater#range_partitioning_field=}, {Table::Updater#range_partitioning_interval=} and
2659
+ # {Table::Updater#range_partitioning_end=}.
2660
+ #
2661
+ # @param [Integer] range_start The start of range partitioning, inclusive.
2662
+ #
2663
+ # @example
2664
+ # require "google/cloud/bigquery"
2665
+ #
2666
+ # bigquery = Google::Cloud::Bigquery.new
2667
+ # dataset = bigquery.dataset "my_dataset"
2668
+ #
2669
+ # table = dataset.create_table "my_table" do |t|
2670
+ # t.schema do |schema|
2671
+ # schema.integer "my_table_id", mode: :required
2672
+ # schema.string "my_table_data", mode: :required
2673
+ # end
2674
+ # t.range_partitioning_field = "my_table_id"
2675
+ # t.range_partitioning_start = 0
2676
+ # t.range_partitioning_interval = 10
2677
+ # t.range_partitioning_end = 100
2678
+ # end
2679
+ #
2680
+ # @!group Attributes
2681
+ #
2682
+ def range_partitioning_start= range_start
2683
+ reload! unless resource_full?
2684
+ @gapi.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
2685
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
2686
+ )
2687
+ @gapi.range_partitioning.range.start = range_start
2688
+ patch_gapi! :range_partitioning
2689
+ end
2690
+
2691
+ ##
2692
+ # Sets width of each interval for data in range partitions. See [Creating and using integer range partitioned
2693
+ # tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
2694
+ #
2695
+ # You can only set range partitioning when creating a table as in the example below. BigQuery does not allow
2696
+ # you to change partitioning on an existing table.
2697
+ #
2698
+ # See {Table::Updater#range_partitioning_field=}, {Table::Updater#range_partitioning_start=} and
2699
+ # {Table::Updater#range_partitioning_end=}.
2700
+ #
2701
+ # @param [Integer] range_interval The width of each interval, for data in partitions.
2702
+ #
2703
+ # @example
2704
+ # require "google/cloud/bigquery"
2705
+ #
2706
+ # bigquery = Google::Cloud::Bigquery.new
2707
+ # dataset = bigquery.dataset "my_dataset"
2708
+ #
2709
+ # table = dataset.create_table "my_table" do |t|
2710
+ # t.schema do |schema|
2711
+ # schema.integer "my_table_id", mode: :required
2712
+ # schema.string "my_table_data", mode: :required
2713
+ # end
2714
+ # t.range_partitioning_field = "my_table_id"
2715
+ # t.range_partitioning_start = 0
2716
+ # t.range_partitioning_interval = 10
2717
+ # t.range_partitioning_end = 100
2718
+ # end
2719
+ #
2720
+ # @!group Attributes
2721
+ #
2722
+ def range_partitioning_interval= range_interval
2723
+ reload! unless resource_full?
2724
+ @gapi.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
2725
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
2726
+ )
2727
+ @gapi.range_partitioning.range.interval = range_interval
2728
+ patch_gapi! :range_partitioning
2729
+ end
2730
+
2731
+ ##
2732
+ # Sets the end of range partitioning, exclusive, for the table. See [Creating and using integer range
2733
+ # partitioned tables](https://cloud.google.com/bigquery/docs/creating-integer-range-partitions).
2734
+ #
2735
+ # You can only set range partitioning when creating a table as in the example below. BigQuery does not allow
2736
+ # you to change partitioning on an existing table.
2737
+ #
2738
+ # See {Table::Updater#range_partitioning_start=}, {Table::Updater#range_partitioning_interval=} and
2739
+ # {Table::Updater#range_partitioning_field=}.
2740
+ #
2741
+ # @param [Integer] range_end The end of range partitioning, exclusive.
2742
+ #
2743
+ # @example
2744
+ # require "google/cloud/bigquery"
2745
+ #
2746
+ # bigquery = Google::Cloud::Bigquery.new
2747
+ # dataset = bigquery.dataset "my_dataset"
2748
+ #
2749
+ # table = dataset.create_table "my_table" do |t|
2750
+ # t.schema do |schema|
2751
+ # schema.integer "my_table_id", mode: :required
2752
+ # schema.string "my_table_data", mode: :required
2753
+ # end
2754
+ # t.range_partitioning_field = "my_table_id"
2755
+ # t.range_partitioning_start = 0
2756
+ # t.range_partitioning_interval = 10
2757
+ # t.range_partitioning_end = 100
2758
+ # end
2759
+ #
2760
+ # @!group Attributes
2761
+ #
2762
+ def range_partitioning_end= range_end
2763
+ reload! unless resource_full?
2764
+ @gapi.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new(
2765
+ range: Google::Apis::BigqueryV2::RangePartitioning::Range.new
2766
+ )
2767
+ @gapi.range_partitioning.range.end = range_end
2768
+ patch_gapi! :range_partitioning
2769
+ end
2770
+
2524
2771
  ##
2525
2772
  # Sets one or more fields on which data should be clustered. Must be
2526
2773
  # specified with time-based partitioning, data in the table will be
@@ -2552,15 +2799,15 @@ module Google
2552
2799
  #
2553
2800
  # bigquery = Google::Cloud::Bigquery.new
2554
2801
  # dataset = bigquery.dataset "my_dataset"
2555
- # table = dataset.create_table "my_table" do |table|
2556
- # table.time_partitioning_type = "DAY"
2557
- # table.time_partitioning_field = "dob"
2558
- # table.schema do |schema|
2802
+ # table = dataset.create_table "my_table" do |t|
2803
+ # t.schema do |schema|
2559
2804
  # schema.timestamp "dob", mode: :required
2560
2805
  # schema.string "first_name", mode: :required
2561
2806
  # schema.string "last_name", mode: :required
2562
2807
  # end
2563
- # table.clustering_fields = ["last_name", "first_name"]
2808
+ # t.time_partitioning_type = "DAY"
2809
+ # t.time_partitioning_field = "dob"
2810
+ # t.clustering_fields = ["last_name", "first_name"]
2564
2811
  # end
2565
2812
  #
2566
2813
  # @!group Attributes
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "1.19.0".freeze
19
+ VERSION = "1.20.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-bigquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-02-12 00:00:00.000000000 Z
12
+ date: 2020-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -185,14 +185,14 @@ dependencies:
185
185
  requirements:
186
186
  - - "~>"
187
187
  - !ruby/object:Gem::Version
188
- version: '0.9'
188
+ version: '0.18'
189
189
  type: :development
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
193
  - - "~>"
194
194
  - !ruby/object:Gem::Version
195
- version: '0.9'
195
+ version: '0.18'
196
196
  - !ruby/object:Gem::Dependency
197
197
  name: yard
198
198
  requirement: !ruby/object:Gem::Requirement