lib/google/cloud/bigquery/project.rb in google-cloud-bigquery-1.21.1 vs lib/google/cloud/bigquery/project.rb in google-cloud-bigquery-1.21.2
- old
+ new
@@ -715,25 +715,31 @@
# bigquery = Google::Cloud::Bigquery.new
#
# sql = "SELECT name FROM `my_project.my_dataset.my_table`"
# data = bigquery.query sql
#
+ # # Iterate over the first page of results
# data.each do |row|
# puts row[:name]
# end
+ # # Retrieve the next page of results
+ # data = data.next if data.next?
#
# @example Query using legacy SQL:
# require "google/cloud/bigquery"
#
# bigquery = Google::Cloud::Bigquery.new
#
# sql = "SELECT name FROM [my_project:my_dataset.my_table]"
# data = bigquery.query sql, legacy_sql: true
#
+ # # Iterate over the first page of results
# data.each do |row|
# puts row[:name]
# end
+ # # Retrieve the next page of results
+ # data = data.next if data.next?
#
# @example Retrieve all rows: (See {Data#all})
# require "google/cloud/bigquery"
#
# bigquery = Google::Cloud::Bigquery.new
@@ -752,13 +758,16 @@
# data = bigquery.query "SELECT name " \
# "FROM `my_dataset.my_table` " \
# "WHERE id = ?",
# params: [1]
#
+ # # Iterate over the first page of results
# data.each do |row|
# puts row[:name]
# end
+ # # Retrieve the next page of results
+ # data = data.next if data.next?
#
# @example Query using named query parameters:
# require "google/cloud/bigquery"
#
# bigquery = Google::Cloud::Bigquery.new
@@ -766,13 +775,16 @@
# data = bigquery.query "SELECT name " \
# "FROM `my_dataset.my_table` " \
# "WHERE id = @id",
# params: { id: 1 }
#
+ # # Iterate over the first page of results
# data.each do |row|
# puts row[:name]
# end
+ # # Retrieve the next page of results
+ # data = data.next if data.next?
#
# @example Query using named query parameters with types:
# require "google/cloud/bigquery"
#
# bigquery = Google::Cloud::Bigquery.new
@@ -781,13 +793,16 @@
# "`my_dataset.my_table` " \
# "WHERE id IN UNNEST(@ids)",
# params: { ids: [] },
# types: { ids: [:INT64] }
#
+ # # Iterate over the first page of results
# data.each do |row|
# puts row[:name]
# end
+ # # Retrieve the next page of results
+ # data = data.next if data.next?
#
# @example Execute a DDL statement:
# require "google/cloud/bigquery"
#
# bigquery = Google::Cloud::Bigquery.new
@@ -822,13 +837,16 @@
# query.external = { my_ext_table: csv_table }
# dataset = bigquery.dataset "my_dataset", skip_lookup: true
# query.table = dataset.table "my_table", skip_lookup: true
# end
#
+ # # Iterate over the first page of results
# data.each do |row|
# puts row[:name]
# end
+ # # Retrieve the next page of results
+ # data = data.next if data.next?
#
def query query, params: nil, types: nil, external: nil, max: nil, cache: true, dataset: nil, project: nil,
standard_sql: nil, legacy_sql: nil, &block
job = query_job query, params: params, types: types, external: external, cache: cache, dataset: dataset,
project: project, standard_sql: standard_sql, legacy_sql: legacy_sql, &block
@@ -886,13 +904,16 @@
# end
#
# data = bigquery.query "SELECT * FROM my_ext_table",
# external: { my_ext_table: csv_table }
#
+ # # Iterate over the first page of results
# data.each do |row|
# puts row[:name]
# end
+ # # Retrieve the next page of results
+ # data = data.next if data.next?
#
def external url, format: nil
ext = External.from_urls url, format
yield ext if block_given?
ext
@@ -1282,13 +1303,16 @@
# data = bigquery.query "SELECT name " \
# "FROM `my_dataset.my_table`" \
# "WHERE time_of_date = @time",
# params: { time: fourpm }
#
+ # # Iterate over the first page of results
# data.each do |row|
# puts row[:name]
# end
+ # # Retrieve the next page of results
+ # data = data.next if data.next?
#
# @example Create Time with fractional seconds:
# require "google/cloud/bigquery"
#
# bigquery = Google::Cloud::Bigquery.new
@@ -1297,12 +1321,15 @@
# data = bigquery.query "SELECT name " \
# "FROM `my_dataset.my_table`" \
# "WHERE time_of_date >= @time",
# params: { time: precise_time }
#
+ # # Iterate over the first page of results
# data.each do |row|
# puts row[:name]
# end
+ # # Retrieve the next page of results
+ # data = data.next if data.next?
#
def time hour, minute, second
Bigquery::Time.new "#{hour}:#{minute}:#{second}"
end