google-cloud-bigquery 0.20.2 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,10 +79,9 @@ module Google
79
79
  # @return [Boolean]
80
80
  #
81
81
  # @example
82
- # require "google/cloud"
82
+ # require "google/cloud/bigquery"
83
83
  #
84
- # gcloud = Google::Cloud.new
85
- # bigquery = gcloud.bigquery
84
+ # bigquery = Google::Cloud::Bigquery.new
86
85
  # job = bigquery.job "my_job"
87
86
  #
88
87
  # data = job.query_results
@@ -100,10 +99,9 @@ module Google
100
99
  # @return [QueryData]
101
100
  #
102
101
  # @example
103
- # require "google/cloud"
102
+ # require "google/cloud/bigquery"
104
103
  #
105
- # gcloud = Google::Cloud.new
106
- # bigquery = gcloud.bigquery
104
+ # bigquery = Google::Cloud::Bigquery.new
107
105
  # job = bigquery.job "my_job"
108
106
  #
109
107
  # data = job.query_results
@@ -137,10 +135,9 @@ module Google
137
135
  # @return [Enumerator]
138
136
  #
139
137
  # @example Iterating each row by passing a block:
140
- # require "google/cloud"
138
+ # require "google/cloud/bigquery"
141
139
  #
142
- # gcloud = Google::Cloud.new
143
- # bigquery = gcloud.bigquery
140
+ # bigquery = Google::Cloud::Bigquery.new
144
141
  # job = bigquery.job "my_job"
145
142
  #
146
143
  # data = job.query_results
@@ -149,10 +146,9 @@ module Google
149
146
  # end
150
147
  #
151
148
  # @example Using the enumerator by not passing a block:
152
- # require "google/cloud"
149
+ # require "google/cloud/bigquery"
153
150
  #
154
- # gcloud = Google::Cloud.new
155
- # bigquery = gcloud.bigquery
151
+ # bigquery = Google::Cloud::Bigquery.new
156
152
  # job = bigquery.job "my_job"
157
153
  #
158
154
  # data = job.query_results
@@ -161,10 +157,9 @@ module Google
161
157
  # end
162
158
  #
163
159
  # @example Limit the number of API calls made:
164
- # require "google/cloud"
160
+ # require "google/cloud/bigquery"
165
161
  #
166
- # gcloud = Google::Cloud.new
167
- # bigquery = gcloud.bigquery
162
+ # bigquery = Google::Cloud::Bigquery.new
168
163
  # job = bigquery.job "my_job"
169
164
  #
170
165
  # data = job.query_results
@@ -112,10 +112,9 @@ module Google
112
112
  # @return [Google::Cloud::Bigquery::QueryData]
113
113
  #
114
114
  # @example
115
- # require "google/cloud"
115
+ # require "google/cloud/bigquery"
116
116
  #
117
- # gcloud = Google::Cloud.new
118
- # bigquery = gcloud.bigquery
117
+ # bigquery = Google::Cloud::Bigquery.new
119
118
  #
120
119
  # q = "SELECT word FROM publicdata:samples.shakespeare"
121
120
  # job = bigquery.query_job q
@@ -27,10 +27,9 @@ module Google
27
27
  # Preparing Data for BigQuery
28
28
  #
29
29
  # @example
30
- # require "google/cloud"
30
+ # require "google/cloud/bigquery"
31
31
  #
32
- # gcloud = Google::Cloud.new
33
- # bigquery = gcloud.bigquery
32
+ # bigquery = Google::Cloud::Bigquery.new
34
33
  # dataset = bigquery.dataset "my_dataset"
35
34
  # table = dataset.create_table "my_table"
36
35
  #
@@ -202,10 +201,9 @@ module Google
202
201
  # nested schema
203
202
  #
204
203
  # @example
205
- # require "google/cloud"
204
+ # require "google/cloud/bigquery"
206
205
  #
207
- # gcloud = Google::Cloud.new
208
- # bigquery = gcloud.bigquery
206
+ # bigquery = Google::Cloud::Bigquery.new
209
207
  # dataset = bigquery.dataset "my_dataset"
210
208
  # table = dataset.create_table "my_table"
211
209
  #
@@ -53,7 +53,7 @@ module Google
53
53
  return mocked_service if mocked_service
54
54
  @service ||= begin
55
55
  service = API::BigqueryService.new
56
- service.client_options.application_name = "google-cloud-bigquery"
56
+ service.client_options.application_name = "gcloud-ruby"
57
57
  service.client_options.application_version = \
58
58
  Google::Cloud::Bigquery::VERSION
59
59
  service.request_options.retries = @retries || 3
@@ -36,10 +36,9 @@ module Google
36
36
  # Preparing Data for BigQuery
37
37
  #
38
38
  # @example
39
- # require "google/cloud"
39
+ # require "google/cloud/bigquery"
40
40
  #
41
- # gcloud = Google::Cloud.new
42
- # bigquery = gcloud.bigquery
41
+ # bigquery = Google::Cloud::Bigquery.new
43
42
  # dataset = bigquery.dataset "my_dataset"
44
43
  #
45
44
  # table = dataset.create_table "my_table" do |schema|
@@ -139,10 +138,9 @@ module Google
139
138
  # Useful in queries.
140
139
  #
141
140
  # @example
142
- # require "google/cloud"
141
+ # require "google/cloud/bigquery"
143
142
  #
144
- # gcloud = Google::Cloud.new
145
- # bigquery = gcloud.bigquery
143
+ # bigquery = Google::Cloud::Bigquery.new
146
144
  # dataset = bigquery.dataset "my_dataset"
147
145
  # table = dataset.table "my_table"
148
146
  #
@@ -330,10 +328,9 @@ module Google
330
328
  # @return [Google::Cloud::Bigquery::Schema]
331
329
  #
332
330
  # @example
333
- # require "google/cloud"
331
+ # require "google/cloud/bigquery"
334
332
  #
335
- # gcloud = Google::Cloud.new
336
- # bigquery = gcloud.bigquery
333
+ # bigquery = Google::Cloud::Bigquery.new
337
334
  # dataset = bigquery.dataset "my_dataset"
338
335
  # table = dataset.create_table "my_table"
339
336
  #
@@ -396,10 +393,9 @@ module Google
396
393
  # @return [Google::Cloud::Bigquery::Data]
397
394
  #
398
395
  # @example Paginate rows of data: (See {Data#next})
399
- # require "google/cloud"
396
+ # require "google/cloud/bigquery"
400
397
  #
401
- # gcloud = Google::Cloud.new
402
- # bigquery = gcloud.bigquery
398
+ # bigquery = Google::Cloud::Bigquery.new
403
399
  # dataset = bigquery.dataset "my_dataset"
404
400
  # table = dataset.table "my_table"
405
401
  #
@@ -412,10 +408,9 @@ module Google
412
408
  # end
413
409
  #
414
410
  # @example Retrieve all rows of data: (See {Data#all})
415
- # require "google/cloud"
411
+ # require "google/cloud/bigquery"
416
412
  #
417
- # gcloud = Google::Cloud.new
418
- # bigquery = gcloud.bigquery
413
+ # bigquery = Google::Cloud::Bigquery.new
419
414
  # dataset = bigquery.dataset "my_dataset"
420
415
  # table = dataset.table "my_table"
421
416
  #
@@ -463,10 +458,9 @@ module Google
463
458
  # @return [Google::Cloud::Bigquery::CopyJob]
464
459
  #
465
460
  # @example
466
- # require "google/cloud"
461
+ # require "google/cloud/bigquery"
467
462
  #
468
- # gcloud = Google::Cloud.new
469
- # bigquery = gcloud.bigquery
463
+ # bigquery = Google::Cloud::Bigquery.new
470
464
  # dataset = bigquery.dataset "my_dataset"
471
465
  # table = dataset.table "my_table"
472
466
  # destination_table = dataset.table "my_destination_table"
@@ -474,10 +468,9 @@ module Google
474
468
  # copy_job = table.copy destination_table
475
469
  #
476
470
  # @example Passing a string identifier for the destination table:
477
- # require "google/cloud"
471
+ # require "google/cloud/bigquery"
478
472
  #
479
- # gcloud = Google::Cloud.new
480
- # bigquery = gcloud.bigquery
473
+ # bigquery = Google::Cloud::Bigquery.new
481
474
  # dataset = bigquery.dataset "my_dataset"
482
475
  # table = dataset.table "my_table"
483
476
  #
@@ -523,10 +516,9 @@ module Google
523
516
  # @return [Google::Cloud::Bigquery::ExtractJob]
524
517
  #
525
518
  # @example
526
- # require "google/cloud"
519
+ # require "google/cloud/bigquery"
527
520
  #
528
- # gcloud = Google::Cloud.new
529
- # bigquery = gcloud.bigquery
521
+ # bigquery = Google::Cloud::Bigquery.new
530
522
  # dataset = bigquery.dataset "my_dataset"
531
523
  # table = dataset.table "my_table"
532
524
  #
@@ -634,34 +626,31 @@ module Google
634
626
  # @return [Google::Cloud::Bigquery::LoadJob]
635
627
  #
636
628
  # @example
637
- # require "google/cloud"
629
+ # require "google/cloud/bigquery"
638
630
  #
639
- # gcloud = Google::Cloud.new
640
- # bigquery = gcloud.bigquery
631
+ # bigquery = Google::Cloud::Bigquery.new
641
632
  # dataset = bigquery.dataset "my_dataset"
642
633
  # table = dataset.table "my_table"
643
634
  #
644
635
  # load_job = table.load "gs://my-bucket/file-name.csv"
645
636
  #
646
637
  # @example Pass a google-cloud storage file instance:
647
- # require "google/cloud"
638
+ # require "google/cloud/bigquery"
648
639
  # require "google/cloud/storage"
649
640
  #
650
- # gcloud = Google::Cloud.new
651
- # bigquery = gcloud.bigquery
641
+ # bigquery = Google::Cloud::Bigquery.new
652
642
  # dataset = bigquery.dataset "my_dataset"
653
643
  # table = dataset.table "my_table"
654
644
  #
655
- # storage = gcloud.storage
645
+ # storage = Google::Cloud::Storage.new
656
646
  # bucket = storage.bucket "my-bucket"
657
647
  # file = bucket.file "file-name.csv"
658
648
  # load_job = table.load file
659
649
  #
660
650
  # @example Upload a file directly:
661
- # require "google/cloud"
651
+ # require "google/cloud/bigquery"
662
652
  #
663
- # gcloud = Google::Cloud.new
664
- # bigquery = gcloud.bigquery
653
+ # bigquery = Google::Cloud::Bigquery.new
665
654
  # dataset = bigquery.dataset "my_dataset"
666
655
  # table = dataset.table "my_table"
667
656
  #
@@ -708,10 +697,9 @@ module Google
708
697
  # @return [Google::Cloud::Bigquery::InsertResponse]
709
698
  #
710
699
  # @example
711
- # require "google/cloud"
700
+ # require "google/cloud/bigquery"
712
701
  #
713
- # gcloud = Google::Cloud.new
714
- # bigquery = gcloud.bigquery
702
+ # bigquery = Google::Cloud::Bigquery.new
715
703
  # dataset = bigquery.dataset "my_dataset"
716
704
  # table = dataset.table "my_table"
717
705
  #
@@ -738,10 +726,9 @@ module Google
738
726
  # @return [Boolean] Returns `true` if the table was deleted.
739
727
  #
740
728
  # @example
741
- # require "google/cloud"
729
+ # require "google/cloud/bigquery"
742
730
  #
743
- # gcloud = Google::Cloud.new
744
- # bigquery = gcloud.bigquery
731
+ # bigquery = Google::Cloud::Bigquery.new
745
732
  # dataset = bigquery.dataset "my_dataset"
746
733
  # table = dataset.table "my_table"
747
734
  #
@@ -886,10 +873,9 @@ module Google
886
873
  # @return [Google::Cloud::Bigquery::Schema]
887
874
  #
888
875
  # @example
889
- # require "google/cloud"
876
+ # require "google/cloud/bigquery"
890
877
  #
891
- # gcloud = Google::Cloud.new
892
- # bigquery = gcloud.bigquery
878
+ # bigquery = Google::Cloud::Bigquery.new
893
879
  # dataset = bigquery.dataset "my_dataset"
894
880
  # table = dataset.create_table "my_table" do |t|
895
881
  # t.name = "My Table",
@@ -936,10 +922,9 @@ module Google
936
922
  # `:nullable`.
937
923
  #
938
924
  # @example
939
- # require "google/cloud"
925
+ # require "google/cloud/bigquery"
940
926
  #
941
- # gcloud = Google::Cloud.new
942
- # bigquery = gcloud.bigquery
927
+ # bigquery = Google::Cloud::Bigquery.new
943
928
  # dataset = bigquery.dataset "my_dataset"
944
929
  # table = dataset.create_table "my_table" do |schema|
945
930
  # schema.string "first_name", mode: :required
@@ -965,10 +950,9 @@ module Google
965
950
  # `:nullable`.
966
951
  #
967
952
  # @example
968
- # require "google/cloud"
953
+ # require "google/cloud/bigquery"
969
954
  #
970
- # gcloud = Google::Cloud.new
971
- # bigquery = gcloud.bigquery
955
+ # bigquery = Google::Cloud::Bigquery.new
972
956
  # dataset = bigquery.dataset "my_dataset"
973
957
  # table = dataset.create_table "my_table" do |schema|
974
958
  # schema.integer "age", mode: :required
@@ -994,10 +978,9 @@ module Google
994
978
  # `:nullable`.
995
979
  #
996
980
  # @example
997
- # require "google/cloud"
981
+ # require "google/cloud/bigquery"
998
982
  #
999
- # gcloud = Google::Cloud.new
1000
- # bigquery = gcloud.bigquery
983
+ # bigquery = Google::Cloud::Bigquery.new
1001
984
  # dataset = bigquery.dataset "my_dataset"
1002
985
  # table = dataset.create_table "my_table" do |schema|
1003
986
  # schema.float "price", mode: :required
@@ -1023,10 +1006,9 @@ module Google
1023
1006
  # `:nullable`.
1024
1007
  #
1025
1008
  # @example
1026
- # require "google/cloud"
1009
+ # require "google/cloud/bigquery"
1027
1010
  #
1028
- # gcloud = Google::Cloud.new
1029
- # bigquery = gcloud.bigquery
1011
+ # bigquery = Google::Cloud::Bigquery.new
1030
1012
  # dataset = bigquery.dataset "my_dataset"
1031
1013
  # table = dataset.create_table "my_table" do |schema|
1032
1014
  # schema.boolean "active", mode: :required
@@ -1052,10 +1034,9 @@ module Google
1052
1034
  # `:nullable`.
1053
1035
  #
1054
1036
  # @example
1055
- # require "google/cloud"
1037
+ # require "google/cloud/bigquery"
1056
1038
  #
1057
- # gcloud = Google::Cloud.new
1058
- # bigquery = gcloud.bigquery
1039
+ # bigquery = Google::Cloud::Bigquery.new
1059
1040
  # dataset = bigquery.dataset "my_dataset"
1060
1041
  # table = dataset.create_table "my_table" do |schema|
1061
1042
  # schema.timestamp "creation_date", mode: :required
@@ -1087,10 +1068,9 @@ module Google
1087
1068
  # nested schema
1088
1069
  #
1089
1070
  # @example
1090
- # require "google/cloud"
1071
+ # require "google/cloud/bigquery"
1091
1072
  #
1092
- # gcloud = Google::Cloud.new
1093
- # bigquery = gcloud.bigquery
1073
+ # bigquery = Google::Cloud::Bigquery.new
1094
1074
  # dataset = bigquery.dataset "my_dataset"
1095
1075
  # table = dataset.create_table "my_table" do |schema|
1096
1076
  # schema.record "cities_lived", mode: :repeated do |cities_lived|
@@ -45,10 +45,9 @@ module Google
45
45
  # @return [Boolean]
46
46
  #
47
47
  # @example
48
- # require "google/cloud"
48
+ # require "google/cloud/bigquery"
49
49
  #
50
- # gcloud = Google::Cloud.new
51
- # bigquery = gcloud.bigquery
50
+ # bigquery = Google::Cloud::Bigquery.new
52
51
  # dataset = bigquery.dataset "my_dataset"
53
52
  #
54
53
  # tables = dataset.tables
@@ -66,10 +65,9 @@ module Google
66
65
  # @return [Table::List]
67
66
  #
68
67
  # @example
69
- # require "google/cloud"
68
+ # require "google/cloud/bigquery"
70
69
  #
71
- # gcloud = Google::Cloud.new
72
- # bigquery = gcloud.bigquery
70
+ # bigquery = Google::Cloud::Bigquery.new
73
71
  # dataset = bigquery.dataset "my_dataset"
74
72
  #
75
73
  # tables = dataset.tables
@@ -104,10 +102,9 @@ module Google
104
102
  # @return [Enumerator]
105
103
  #
106
104
  # @example Iterating each result by passing a block:
107
- # require "google/cloud"
105
+ # require "google/cloud/bigquery"
108
106
  #
109
- # gcloud = Google::Cloud.new
110
- # bigquery = gcloud.bigquery
107
+ # bigquery = Google::Cloud::Bigquery.new
111
108
  # dataset = bigquery.dataset "my_dataset"
112
109
  #
113
110
  # dataset.tables.all do |table|
@@ -115,10 +112,9 @@ module Google
115
112
  # end
116
113
  #
117
114
  # @example Using the enumerator by not passing a block:
118
- # require "google/cloud"
115
+ # require "google/cloud/bigquery"
119
116
  #
120
- # gcloud = Google::Cloud.new
121
- # bigquery = gcloud.bigquery
117
+ # bigquery = Google::Cloud::Bigquery.new
122
118
  # dataset = bigquery.dataset "my_dataset"
123
119
  #
124
120
  # all_names = dataset.tables.all.map do |table|
@@ -126,10 +122,9 @@ module Google
126
122
  # end
127
123
  #
128
124
  # @example Limit the number of API requests made:
129
- # require "google/cloud"
125
+ # require "google/cloud/bigquery"
130
126
  #
131
- # gcloud = Google::Cloud.new
132
- # bigquery = gcloud.bigquery
127
+ # bigquery = Google::Cloud::Bigquery.new
133
128
  # dataset = bigquery.dataset "my_dataset"
134
129
  #
135
130
  # dataset.tables.all(request_limit: 10) do |table|
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "0.20.2"
19
+ VERSION = "0.21.0"
20
20
  end
21
21
  end
22
22
  end
@@ -35,10 +35,9 @@ module Google
35
35
  # query.
36
36
  #
37
37
  # @example
38
- # require "google/cloud"
38
+ # require "google/cloud/bigquery"
39
39
  #
40
- # gcloud = Google::Cloud.new
41
- # bigquery = gcloud.bigquery
40
+ # bigquery = Google::Cloud::Bigquery.new
42
41
  # dataset = bigquery.dataset "my_dataset"
43
42
  # view = dataset.create_view "my_view",
44
43
  # "SELECT name, age FROM [proj:dataset.users]"
@@ -117,10 +116,9 @@ module Google
117
116
  # Useful in queries.
118
117
  #
119
118
  # @example
120
- # require "google/cloud"
119
+ # require "google/cloud/bigquery"
121
120
  #
122
- # gcloud = Google::Cloud.new
123
- # bigquery = gcloud.bigquery
121
+ # bigquery = Google::Cloud::Bigquery.new
124
122
  # dataset = bigquery.dataset "my_dataset"
125
123
  # table = dataset.table "my_table"
126
124
  #
@@ -310,10 +308,9 @@ module Google
310
308
  # @param [String] new_query The query that defines the view.
311
309
  #
312
310
  # @example
313
- # require "google/cloud"
311
+ # require "google/cloud/bigquery"
314
312
  #
315
- # gcloud = Google::Cloud.new
316
- # bigquery = gcloud.bigquery
313
+ # bigquery = Google::Cloud::Bigquery.new
317
314
  # dataset = bigquery.dataset "my_dataset"
318
315
  # view = dataset.table "my_view"
319
316
  #
@@ -356,10 +353,9 @@ module Google
356
353
  # @return [Google::Cloud::Bigquery::QueryData]
357
354
  #
358
355
  # @example
359
- # require "google/cloud"
356
+ # require "google/cloud/bigquery"
360
357
  #
361
- # gcloud = Google::Cloud.new
362
- # bigquery = gcloud.bigquery
358
+ # bigquery = Google::Cloud::Bigquery.new
363
359
  # dataset = bigquery.dataset "my_dataset"
364
360
  # view = dataset.table "my_view"
365
361
  #
@@ -385,10 +381,9 @@ module Google
385
381
  # @return [Boolean] Returns `true` if the table was deleted.
386
382
  #
387
383
  # @example
388
- # require "google/cloud"
384
+ # require "google/cloud/bigquery"
389
385
  #
390
- # gcloud = Google::Cloud.new
391
- # bigquery = gcloud.bigquery
386
+ # bigquery = Google::Cloud::Bigquery.new
392
387
  # dataset = bigquery.dataset "my_dataset"
393
388
  # table = dataset.table "my_table"
394
389
  #