bigquery/tables.rb
def create_table project_id:, dataset_id:, table_id:
  # [START bigquery_create_table]
  # project_id = "Your Google Cloud project ID"
  # dataset_id = "ID of the dataset to create table in"
  # table_id   = "ID of the table to create"

  require "google/cloud/bigquery"

  bigquery = Google::Cloud::Bigquery.new project: project_id
  dataset  = bigquery.dataset dataset_id

  table    = dataset.create_table table_id do |updater|
    updater.string  "full_name", mode: :required
    updater.integer "age",       mode: :required
  end

  puts "Created table: #{table_id}"
  # [END bigquery_create_table]
end
# Copyright 2016 Google, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing software distributed under the License is distributed on an " AS IS " BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied . See the License for the specific language governing permissions and limitations under the License .
def create_table project_id:, dataset_id:, table_id:
  require "google/cloud/bigquery"
  bigquery = Google::Cloud::Bigquery.new project: project_id
  dataset  = bigquery.dataset dataset_id
  table    = dataset.create_table table_id do |updater|
    updater.string  "full_name", mode: :required
    updater.integer "age",       mode: :required
  end
  puts "Created table: #{table_id}"
end
def create_table project_id : , dataset_id : , table_id : require "google/cloud/bigquery" bigquery = Google :: Cloud :: Bigquery . new project : project_id dataset = bigquery . dataset dataset_id table = dataset . create_table table_id do | updater | updater . string "full_name" , mode : :required updater . integer "age" , mode : :required end puts "Created table: #{table_id}" end
Copyright 2016 Google, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Copyright 2016 Google Inc Licensed under the Apache License Version 2 . 0 ( the " License " ) ; you may not use this file except in compliance with the License .
# [START bigquery_create_table] # project_id = "Your Google Cloud project ID" # dataset_id = "ID of the dataset to create table in" # table_id   = "ID of the table to create" # [END bigquery_create_table]
project_id
dataset_id
table_id