Google Cloud Ruby Client 介绍
该项目是 Google Cloud 官方的 Ruby 客户端开发包。
安装:$ gem install google-cloud
示例代码:
require "google/cloud/bigquery" bigquery = Google::Cloud::Bigquery.new( project: "my-todo-project", keyfile: "/path/to/keyfile.json" ) # Create a new table to archive todos dataset = bigquery.dataset "my-todo-archive" table = dataset.create_table "todos", name: "Todos Archive", description: "Archive for completed TODO records" # Load data into the table file = File.open "/archive/todos/completed-todos.csv" load_job = table.load file # Run a query for the number of completed todos by owner count_sql = "SELECT owner, COUNT(*) AS complete_count FROM todos GROUP BY owner" data = bigquery.query count_sql data.each do |row| puts row["name"] end
Google Cloud Ruby Client 官网
https://googlecloudplatform.github.io/google-cloud-ruby/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。