lib/google/cloud/bigquery/dataset.rb in google-cloud-bigquery-0.20.2 vs lib/google/cloud/bigquery/dataset.rb in google-cloud-bigquery-0.21.0
- old
+ new
@@ -31,14 +31,13 @@
# or more tables. Datasets are the lowest level unit of access control;
# you cannot control access at the table level. A dataset is contained
# within a specific project.
#
# @example
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
#
# dataset = bigquery.create_dataset "my_dataset",
# name: "My Dataset",
# description: "This is my Dataset"
#
@@ -223,14 +222,13 @@
# @yieldparam [Dataset::Access] access the object accepting rules
#
# @return [Google::Cloud::Bigquery::Dataset::Access]
#
# @example
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
#
# dataset.access #=> [{"role"=>"OWNER",
# # "specialGroup"=>"projectOwners"},
# # {"role"=>"WRITER",
@@ -239,14 +237,13 @@
# # "specialGroup"=>"projectReaders"},
# # {"role"=>"OWNER",
# # "userByEmail"=>"123456789-...com"}]
#
# @example Manage the access rules by passing a block:
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
#
# dataset.access do |access|
# access.add_owner_group "owners@example.com"
# access.add_writer_user "writer@example.com"
@@ -277,14 +274,13 @@
# will fail. Default is `false`.
#
# @return [Boolean] Returns `true` if the dataset was deleted.
#
# @example
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
#
# dataset = bigquery.dataset "my_dataset"
# dataset.delete
#
# @!group Lifecycle
@@ -313,32 +309,29 @@
# @yieldparam [Table] table the table object to be updated
#
# @return [Google::Cloud::Bigquery::Table]
#
# @example
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
# table = dataset.create_table "my_table"
#
# @example You can also pass name and description options.
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
# table = dataset.create_table "my_table"
# name: "My Table",
# description: "A description of table."
#
# @example The table's schema fields can be passed as an argument.
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
#
# schema_fields = [
# Google::Cloud::Bigquery::Schema::Field.new(
# "first_name", :string, mode: :required),
@@ -352,14 +345,13 @@
# ])
# ]
# table = dataset.create_table "my_table", fields: schema_fields
#
# @example Or the table's schema can be configured with the block.
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
#
# table = dataset.create_table "my_table" do |t|
# t.schema.string "first_name", mode: :required
# t.schema.record "cities_lived", mode: :required do |s|
@@ -367,14 +359,13 @@
# s.integer "number_of_years", mode: :required
# end
# end
#
# @example You can define the schema using a nested block.
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
# table = dataset.create_table "my_table" do |t|
# t.name = "My Table",
# t.description = "A description of my table."
# t.schema do |s|
@@ -418,23 +409,21 @@
# @param [String] description A user-friendly description of the table.
#
# @return [Google::Cloud::Bigquery::View]
#
# @example
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
# view = dataset.create_view "my_view",
# "SELECT name, age FROM [proj:dataset.users]"
#
# @example A name and description can be provided:
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
# view = dataset.create_view "my_view",
# "SELECT name, age FROM [proj:dataset.users]",
# name: "My View", description: "This is my view"
#
@@ -465,14 +454,13 @@
# @return [Google::Cloud::Bigquery::Table,
# Google::Cloud::Bigquery::View, nil] Returns `nil` if the table does
# not exist
#
# @example
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
# table = dataset.table "my_table"
# puts table.name
#
# @!group Table
@@ -495,25 +483,23 @@
# @return [Array<Google::Cloud::Bigquery::Table>,
# Array<Google::Cloud::Bigquery::View>] (See
# {Google::Cloud::Bigquery::Table::List})
#
# @example
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
# tables = dataset.tables
# tables.each do |table|
# puts table.name
# end
#
# @example Retrieve all tables: (See {Table::List#all})
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
# dataset = bigquery.dataset "my_dataset"
# tables = dataset.tables
# tables.all do |table|
# puts table.name
# end
@@ -574,14 +560,13 @@
# parameter must be `true` if this is set to `false`.
#
# @return [Google::Cloud::Bigquery::QueryJob]
#
# @example
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
#
# job = bigquery.query_job "SELECT name FROM my_table"
#
# job.wait_until_done!
# if !job.failed?
@@ -637,13 +622,12 @@
# caching](https://developers.google.com/bigquery/querying-data).
#
# @return [Google::Cloud::Bigquery::QueryData]
#
# @example
- # require "google/cloud"
+ # require "google/cloud/bigquery"
#
- # gcloud = Google::Cloud.new
- # bigquery = gcloud.bigquery
+ # bigquery = Google::Cloud::Bigquery.new
#
# data = bigquery.query "SELECT name FROM my_table"
# data.each do |row|
# puts row["name"]
# end