google-cloud-bigquery 1.21.1 → 1.21.2
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/google-cloud-bigquery.rb +8 -2
- data/lib/google/cloud/bigquery/data.rb +12 -0
- data/lib/google/cloud/bigquery/dataset.rb +18 -0
- data/lib/google/cloud/bigquery/external.rb +24 -0
- data/lib/google/cloud/bigquery/project.rb +27 -0
- data/lib/google/cloud/bigquery/query_job.rb +3 -0
- data/lib/google/cloud/bigquery/table.rb +7 -5
- data/lib/google/cloud/bigquery/time.rb +6 -0
- data/lib/google/cloud/bigquery/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f38543236358fc319ecfcc2058ffa499e24034027aa56644924d2cf496815550
|
4
|
+
data.tar.gz: 37196fa1c3db03e48df4cb0ae5ae5b9b1ee07b9d112063467ebc57d25b34551a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a234359fb8a04b42f22725f5540cf0378b7e51b3d847ddd4f24ba41f2a54b4de85068bb9aee10089995c29794c0a64694223ac6bf88202eda6a646ce02c85275
|
7
|
+
data.tar.gz: 99c6c915df70afde18de06907802c60d18df253238e6f3ab752827ea3cfc0aee0ab9bef8dc0816f5980db26334dd2b15ce0a2ecf7db3b026e2f0caa101dcafc8
|
data/CHANGELOG.md
CHANGED
@@ -53,9 +53,15 @@ module Google
|
|
53
53
|
# bigquery = gcloud.bigquery
|
54
54
|
# dataset = bigquery.dataset "my_dataset"
|
55
55
|
# table = dataset.table "my_table"
|
56
|
-
#
|
57
|
-
#
|
56
|
+
#
|
57
|
+
# data = table.data
|
58
|
+
#
|
59
|
+
# # Iterate over the first page of results
|
60
|
+
# data.each do |row|
|
61
|
+
# puts row[:name]
|
58
62
|
# end
|
63
|
+
# # Retrieve the next page of results
|
64
|
+
# data = data.next if data.next?
|
59
65
|
#
|
60
66
|
# @example The default scope can be overridden with the `scope` option:
|
61
67
|
# require "google/cloud"
|
@@ -41,9 +41,12 @@ module Google
|
|
41
41
|
#
|
42
42
|
# data.count # 100000
|
43
43
|
# data.total # 164656
|
44
|
+
#
|
45
|
+
# # Iterate over the first page of results
|
44
46
|
# data.each do |row|
|
45
47
|
# puts row[:word]
|
46
48
|
# end
|
49
|
+
# # Retrieve the next page of results
|
47
50
|
# data = data.next if data.next?
|
48
51
|
#
|
49
52
|
class Data < DelegateClass(::Array)
|
@@ -117,9 +120,12 @@ module Google
|
|
117
120
|
#
|
118
121
|
# data.count # 100000
|
119
122
|
# data.total # 164656
|
123
|
+
#
|
124
|
+
# # Iterate over the first page of results
|
120
125
|
# data.each do |row|
|
121
126
|
# puts row[:word]
|
122
127
|
# end
|
128
|
+
# # Retrieve the next page of results
|
123
129
|
# data = data.next if data.next?
|
124
130
|
#
|
125
131
|
def total
|
@@ -375,9 +381,12 @@ module Google
|
|
375
381
|
#
|
376
382
|
# data.count # 100000
|
377
383
|
# data.total # 164656
|
384
|
+
#
|
385
|
+
# # Iterate over the first page of results
|
378
386
|
# data.each do |row|
|
379
387
|
# puts row[:word]
|
380
388
|
# end
|
389
|
+
# # Retrieve the next page of results
|
381
390
|
# data = data.next if data.next?
|
382
391
|
#
|
383
392
|
def next?
|
@@ -402,9 +411,12 @@ module Google
|
|
402
411
|
#
|
403
412
|
# data.count # 100000
|
404
413
|
# data.total # 164656
|
414
|
+
#
|
415
|
+
# # Iterate over the first page of results
|
405
416
|
# data.each do |row|
|
406
417
|
# puts row[:word]
|
407
418
|
# end
|
419
|
+
# # Retrieve the next page of results
|
408
420
|
# data = data.next if data.next?
|
409
421
|
#
|
410
422
|
def next
|
@@ -1474,9 +1474,12 @@ module Google
|
|
1474
1474
|
#
|
1475
1475
|
# data = dataset.query "SELECT name FROM my_table"
|
1476
1476
|
#
|
1477
|
+
# # Iterate over the first page of results
|
1477
1478
|
# data.each do |row|
|
1478
1479
|
# puts row[:name]
|
1479
1480
|
# end
|
1481
|
+
# # Retrieve the next page of results
|
1482
|
+
# data = data.next if data.next?
|
1480
1483
|
#
|
1481
1484
|
# @example Query using legacy SQL:
|
1482
1485
|
# require "google/cloud/bigquery"
|
@@ -1487,9 +1490,12 @@ module Google
|
|
1487
1490
|
# data = dataset.query "SELECT name FROM my_table",
|
1488
1491
|
# legacy_sql: true
|
1489
1492
|
#
|
1493
|
+
# # Iterate over the first page of results
|
1490
1494
|
# data.each do |row|
|
1491
1495
|
# puts row[:name]
|
1492
1496
|
# end
|
1497
|
+
# # Retrieve the next page of results
|
1498
|
+
# data = data.next if data.next?
|
1493
1499
|
#
|
1494
1500
|
# @example Query using positional query parameters:
|
1495
1501
|
# require "google/cloud/bigquery"
|
@@ -1500,9 +1506,12 @@ module Google
|
|
1500
1506
|
# data = dataset.query "SELECT name FROM my_table WHERE id = ?",
|
1501
1507
|
# params: [1]
|
1502
1508
|
#
|
1509
|
+
# # Iterate over the first page of results
|
1503
1510
|
# data.each do |row|
|
1504
1511
|
# puts row[:name]
|
1505
1512
|
# end
|
1513
|
+
# # Retrieve the next page of results
|
1514
|
+
# data = data.next if data.next?
|
1506
1515
|
#
|
1507
1516
|
# @example Query using named query parameters:
|
1508
1517
|
# require "google/cloud/bigquery"
|
@@ -1513,9 +1522,12 @@ module Google
|
|
1513
1522
|
# data = dataset.query "SELECT name FROM my_table WHERE id = @id",
|
1514
1523
|
# params: { id: 1 }
|
1515
1524
|
#
|
1525
|
+
# # Iterate over the first page of results
|
1516
1526
|
# data.each do |row|
|
1517
1527
|
# puts row[:name]
|
1518
1528
|
# end
|
1529
|
+
# # Retrieve the next page of results
|
1530
|
+
# data = data.next if data.next?
|
1519
1531
|
#
|
1520
1532
|
# @example Query using named query parameters with types:
|
1521
1533
|
# require "google/cloud/bigquery"
|
@@ -1528,9 +1540,12 @@ module Google
|
|
1528
1540
|
# params: { ids: [] },
|
1529
1541
|
# types: { ids: [:INT64] }
|
1530
1542
|
#
|
1543
|
+
# # Iterate over the first page of results
|
1531
1544
|
# data.each do |row|
|
1532
1545
|
# puts row[:name]
|
1533
1546
|
# end
|
1547
|
+
# # Retrieve the next page of results
|
1548
|
+
# data = data.next if data.next?
|
1534
1549
|
#
|
1535
1550
|
# @example Execute a DDL statement:
|
1536
1551
|
# require "google/cloud/bigquery"
|
@@ -1569,9 +1584,12 @@ module Google
|
|
1569
1584
|
# query.table = dataset.table "my_table", skip_lookup: true
|
1570
1585
|
# end
|
1571
1586
|
#
|
1587
|
+
# # Iterate over the first page of results
|
1572
1588
|
# data.each do |row|
|
1573
1589
|
# puts row[:name]
|
1574
1590
|
# end
|
1591
|
+
# # Retrieve the next page of results
|
1592
|
+
# data = data.next if data.next?
|
1575
1593
|
#
|
1576
1594
|
# @!group Data
|
1577
1595
|
#
|
@@ -45,9 +45,12 @@ module Google
|
|
45
45
|
# data = bigquery.query "SELECT * FROM my_ext_table",
|
46
46
|
# external: { my_ext_table: csv_table }
|
47
47
|
#
|
48
|
+
# # Iterate over the first page of results
|
48
49
|
# data.each do |row|
|
49
50
|
# puts row[:name]
|
50
51
|
# end
|
52
|
+
# # Retrieve the next page of results
|
53
|
+
# data = data.next if data.next?
|
51
54
|
#
|
52
55
|
module External
|
53
56
|
##
|
@@ -138,9 +141,12 @@ module Google
|
|
138
141
|
# data = bigquery.query "SELECT * FROM my_ext_table",
|
139
142
|
# external: { my_ext_table: avro_table }
|
140
143
|
#
|
144
|
+
# # Iterate over the first page of results
|
141
145
|
# data.each do |row|
|
142
146
|
# puts row[:name]
|
143
147
|
# end
|
148
|
+
# # Retrieve the next page of results
|
149
|
+
# data = data.next if data.next?
|
144
150
|
#
|
145
151
|
class DataSource
|
146
152
|
##
|
@@ -575,9 +581,12 @@ module Google
|
|
575
581
|
# data = bigquery.query "SELECT * FROM my_ext_table",
|
576
582
|
# external: { my_ext_table: csv_table }
|
577
583
|
#
|
584
|
+
# # Iterate over the first page of results
|
578
585
|
# data.each do |row|
|
579
586
|
# puts row[:name]
|
580
587
|
# end
|
588
|
+
# # Retrieve the next page of results
|
589
|
+
# data = data.next if data.next?
|
581
590
|
#
|
582
591
|
class CsvSource < External::DataSource
|
583
592
|
##
|
@@ -1037,9 +1046,12 @@ module Google
|
|
1037
1046
|
# data = bigquery.query "SELECT * FROM my_ext_table",
|
1038
1047
|
# external: { my_ext_table: json_table }
|
1039
1048
|
#
|
1049
|
+
# # Iterate over the first page of results
|
1040
1050
|
# data.each do |row|
|
1041
1051
|
# puts row[:name]
|
1042
1052
|
# end
|
1053
|
+
# # Retrieve the next page of results
|
1054
|
+
# data = data.next if data.next?
|
1043
1055
|
#
|
1044
1056
|
class JsonSource < External::DataSource
|
1045
1057
|
##
|
@@ -1173,9 +1185,12 @@ module Google
|
|
1173
1185
|
# data = bigquery.query "SELECT * FROM my_ext_table",
|
1174
1186
|
# external: { my_ext_table: sheets_table }
|
1175
1187
|
#
|
1188
|
+
# # Iterate over the first page of results
|
1176
1189
|
# data.each do |row|
|
1177
1190
|
# puts row[:name]
|
1178
1191
|
# end
|
1192
|
+
# # Retrieve the next page of results
|
1193
|
+
# data = data.next if data.next?
|
1179
1194
|
#
|
1180
1195
|
class SheetsSource < External::DataSource
|
1181
1196
|
##
|
@@ -1318,9 +1333,12 @@ module Google
|
|
1318
1333
|
# data = bigquery.query "SELECT * FROM my_ext_table",
|
1319
1334
|
# external: { my_ext_table: bigtable_table }
|
1320
1335
|
#
|
1336
|
+
# # Iterate over the first page of results
|
1321
1337
|
# data.each do |row|
|
1322
1338
|
# puts row[:name]
|
1323
1339
|
# end
|
1340
|
+
# # Retrieve the next page of results
|
1341
|
+
# data = data.next if data.next?
|
1324
1342
|
#
|
1325
1343
|
class BigtableSource < External::DataSource
|
1326
1344
|
##
|
@@ -1516,9 +1534,12 @@ module Google
|
|
1516
1534
|
# data = bigquery.query "SELECT * FROM my_ext_table",
|
1517
1535
|
# external: { my_ext_table: bigtable_table }
|
1518
1536
|
#
|
1537
|
+
# # Iterate over the first page of results
|
1519
1538
|
# data.each do |row|
|
1520
1539
|
# puts row[:name]
|
1521
1540
|
# end
|
1541
|
+
# # Retrieve the next page of results
|
1542
|
+
# data = data.next if data.next?
|
1522
1543
|
#
|
1523
1544
|
class ColumnFamily
|
1524
1545
|
##
|
@@ -2053,9 +2074,12 @@ module Google
|
|
2053
2074
|
# data = bigquery.query "SELECT * FROM my_ext_table",
|
2054
2075
|
# external: { my_ext_table: bigtable_table }
|
2055
2076
|
#
|
2077
|
+
# # Iterate over the first page of results
|
2056
2078
|
# data.each do |row|
|
2057
2079
|
# puts row[:name]
|
2058
2080
|
# end
|
2081
|
+
# # Retrieve the next page of results
|
2082
|
+
# data = data.next if data.next?
|
2059
2083
|
#
|
2060
2084
|
class Column
|
2061
2085
|
##
|
@@ -717,9 +717,12 @@ module Google
|
|
717
717
|
# sql = "SELECT name FROM `my_project.my_dataset.my_table`"
|
718
718
|
# data = bigquery.query sql
|
719
719
|
#
|
720
|
+
# # Iterate over the first page of results
|
720
721
|
# data.each do |row|
|
721
722
|
# puts row[:name]
|
722
723
|
# end
|
724
|
+
# # Retrieve the next page of results
|
725
|
+
# data = data.next if data.next?
|
723
726
|
#
|
724
727
|
# @example Query using legacy SQL:
|
725
728
|
# require "google/cloud/bigquery"
|
@@ -729,9 +732,12 @@ module Google
|
|
729
732
|
# sql = "SELECT name FROM [my_project:my_dataset.my_table]"
|
730
733
|
# data = bigquery.query sql, legacy_sql: true
|
731
734
|
#
|
735
|
+
# # Iterate over the first page of results
|
732
736
|
# data.each do |row|
|
733
737
|
# puts row[:name]
|
734
738
|
# end
|
739
|
+
# # Retrieve the next page of results
|
740
|
+
# data = data.next if data.next?
|
735
741
|
#
|
736
742
|
# @example Retrieve all rows: (See {Data#all})
|
737
743
|
# require "google/cloud/bigquery"
|
@@ -754,9 +760,12 @@ module Google
|
|
754
760
|
# "WHERE id = ?",
|
755
761
|
# params: [1]
|
756
762
|
#
|
763
|
+
# # Iterate over the first page of results
|
757
764
|
# data.each do |row|
|
758
765
|
# puts row[:name]
|
759
766
|
# end
|
767
|
+
# # Retrieve the next page of results
|
768
|
+
# data = data.next if data.next?
|
760
769
|
#
|
761
770
|
# @example Query using named query parameters:
|
762
771
|
# require "google/cloud/bigquery"
|
@@ -768,9 +777,12 @@ module Google
|
|
768
777
|
# "WHERE id = @id",
|
769
778
|
# params: { id: 1 }
|
770
779
|
#
|
780
|
+
# # Iterate over the first page of results
|
771
781
|
# data.each do |row|
|
772
782
|
# puts row[:name]
|
773
783
|
# end
|
784
|
+
# # Retrieve the next page of results
|
785
|
+
# data = data.next if data.next?
|
774
786
|
#
|
775
787
|
# @example Query using named query parameters with types:
|
776
788
|
# require "google/cloud/bigquery"
|
@@ -783,9 +795,12 @@ module Google
|
|
783
795
|
# params: { ids: [] },
|
784
796
|
# types: { ids: [:INT64] }
|
785
797
|
#
|
798
|
+
# # Iterate over the first page of results
|
786
799
|
# data.each do |row|
|
787
800
|
# puts row[:name]
|
788
801
|
# end
|
802
|
+
# # Retrieve the next page of results
|
803
|
+
# data = data.next if data.next?
|
789
804
|
#
|
790
805
|
# @example Execute a DDL statement:
|
791
806
|
# require "google/cloud/bigquery"
|
@@ -824,9 +839,12 @@ module Google
|
|
824
839
|
# query.table = dataset.table "my_table", skip_lookup: true
|
825
840
|
# end
|
826
841
|
#
|
842
|
+
# # Iterate over the first page of results
|
827
843
|
# data.each do |row|
|
828
844
|
# puts row[:name]
|
829
845
|
# end
|
846
|
+
# # Retrieve the next page of results
|
847
|
+
# data = data.next if data.next?
|
830
848
|
#
|
831
849
|
def query query, params: nil, types: nil, external: nil, max: nil, cache: true, dataset: nil, project: nil,
|
832
850
|
standard_sql: nil, legacy_sql: nil, &block
|
@@ -888,9 +906,12 @@ module Google
|
|
888
906
|
# data = bigquery.query "SELECT * FROM my_ext_table",
|
889
907
|
# external: { my_ext_table: csv_table }
|
890
908
|
#
|
909
|
+
# # Iterate over the first page of results
|
891
910
|
# data.each do |row|
|
892
911
|
# puts row[:name]
|
893
912
|
# end
|
913
|
+
# # Retrieve the next page of results
|
914
|
+
# data = data.next if data.next?
|
894
915
|
#
|
895
916
|
def external url, format: nil
|
896
917
|
ext = External.from_urls url, format
|
@@ -1284,9 +1305,12 @@ module Google
|
|
1284
1305
|
# "WHERE time_of_date = @time",
|
1285
1306
|
# params: { time: fourpm }
|
1286
1307
|
#
|
1308
|
+
# # Iterate over the first page of results
|
1287
1309
|
# data.each do |row|
|
1288
1310
|
# puts row[:name]
|
1289
1311
|
# end
|
1312
|
+
# # Retrieve the next page of results
|
1313
|
+
# data = data.next if data.next?
|
1290
1314
|
#
|
1291
1315
|
# @example Create Time with fractional seconds:
|
1292
1316
|
# require "google/cloud/bigquery"
|
@@ -1299,9 +1323,12 @@ module Google
|
|
1299
1323
|
# "WHERE time_of_date >= @time",
|
1300
1324
|
# params: { time: precise_time }
|
1301
1325
|
#
|
1326
|
+
# # Iterate over the first page of results
|
1302
1327
|
# data.each do |row|
|
1303
1328
|
# puts row[:name]
|
1304
1329
|
# end
|
1330
|
+
# # Retrieve the next page of results
|
1331
|
+
# data = data.next if data.next?
|
1305
1332
|
#
|
1306
1333
|
def time hour, minute, second
|
1307
1334
|
Bigquery::Time.new "#{hour}:#{minute}:#{second}"
|
@@ -675,9 +675,12 @@ module Google
|
|
675
675
|
#
|
676
676
|
# job.wait_until_done!
|
677
677
|
# data = job.data
|
678
|
+
#
|
679
|
+
# # Iterate over the first page of results
|
678
680
|
# data.each do |row|
|
679
681
|
# puts row[:word]
|
680
682
|
# end
|
683
|
+
# # Retrieve the next page of results
|
681
684
|
# data = data.next if data.next?
|
682
685
|
#
|
683
686
|
def data token: nil, max: nil, start: nil
|
@@ -1286,12 +1286,13 @@ module Google
|
|
1286
1286
|
# table = dataset.table "my_table"
|
1287
1287
|
#
|
1288
1288
|
# data = table.data
|
1289
|
+
#
|
1290
|
+
# # Iterate over the first page of results
|
1289
1291
|
# data.each do |row|
|
1290
|
-
# puts row[:
|
1291
|
-
# end
|
1292
|
-
# if data.next?
|
1293
|
-
# more_data = data.next if data.next?
|
1292
|
+
# puts row[:name]
|
1294
1293
|
# end
|
1294
|
+
# # Retrieve the next page of results
|
1295
|
+
# data = data.next if data.next?
|
1295
1296
|
#
|
1296
1297
|
# @example Retrieve all rows of data: (See {Data#all})
|
1297
1298
|
# require "google/cloud/bigquery"
|
@@ -1301,8 +1302,9 @@ module Google
|
|
1301
1302
|
# table = dataset.table "my_table"
|
1302
1303
|
#
|
1303
1304
|
# data = table.data
|
1305
|
+
#
|
1304
1306
|
# data.all do |row|
|
1305
|
-
# puts row[:
|
1307
|
+
# puts row[:name]
|
1306
1308
|
# end
|
1307
1309
|
#
|
1308
1310
|
# @!group Data
|
@@ -34,9 +34,12 @@ module Google
|
|
34
34
|
# "WHERE time_of_date = @time",
|
35
35
|
# params: { time: fourpm }
|
36
36
|
#
|
37
|
+
# # Iterate over the first page of results
|
37
38
|
# data.each do |row|
|
38
39
|
# puts row[:name]
|
39
40
|
# end
|
41
|
+
# # Retrieve the next page of results
|
42
|
+
# data = data.next if data.next?
|
40
43
|
#
|
41
44
|
# @example Create Time with fractional seconds:
|
42
45
|
# require "google/cloud/bigquery"
|
@@ -49,9 +52,12 @@ module Google
|
|
49
52
|
# "WHERE time_of_date >= @time",
|
50
53
|
# params: { time: precise_time }
|
51
54
|
#
|
55
|
+
# # Iterate over the first page of results
|
52
56
|
# data.each do |row|
|
53
57
|
# puts row[:name]
|
54
58
|
# end
|
59
|
+
# # Retrieve the next page of results
|
60
|
+
# data = data.next if data.next?
|
55
61
|
#
|
56
62
|
Time = Struct.new :value
|
57
63
|
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.21.
|
4
|
+
version: 1.21.2
|
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-
|
12
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
290
|
- !ruby/object:Gem::Version
|
291
291
|
version: '0'
|
292
292
|
requirements: []
|
293
|
-
rubygems_version: 3.
|
293
|
+
rubygems_version: 3.1.3
|
294
294
|
signing_key:
|
295
295
|
specification_version: 4
|
296
296
|
summary: API Client library for Google BigQuery
|