SlideShare a Scribd company logo
Confidential & Proprietary
Google BigQueryIntroduction / BigQuery Organization /
Exploring and Interacting with BigQuery
Google Cloud カスタマーエンジニア
Google Cloud ベストプラクティス
Confidential & Proprietary
Agenda
● Introduction
● BigQuery Organization
● Exploring and Interacting
with BigQuery
Google Cloud ベストプラクティス Google BigQuery
※このスライドは 2017 年 12 月時点の情報に基づき作成しています。最新情報は Google Cloud Platform のドキュメントをご参照ください。
 https://cloud.google.com/docs/
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
● 億件レベルの大規模データセットに対する高速クエリ
● 分析用のデータウェアハウス
○ UPDATE, DELETE, INSERT は制限あり
● セットアップ、パフォーマンスチューニングやクラスタ拡張といったイ
ンフラ作業不要
● ストレージ容量無制限。自動スケールアウト
Google BigQuery とは
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
● BI ツールを使って非技術者でも操作可能
○ Tableau, QlickView, Google DataStudio, Google
Spreadsheet / Microsoft Excel (ODBC, JDBC)
● ETL
○ クエリ結果をテーブルに出力可能
○ JSON 関数/正規表現関数
● データ処理エンジンとの連携
○ Cloud Dataflow, Cloud Dataproc, Hadoop
Google BigQuery とは
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
BigQuery
ログ収集/分析基盤
Cloud Logging
App Engine
Analytics Server
Google Analytics
Compute Engine
On-premise / 他社クラウド
Google
Spreadsheet
Stream API
File
3rd party tools
Simba ODBC Driver
Google BigQuery 参考構成
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
5 年間における絶え間ないイノベーション
2010 2011 2012 2013 2014
一般公開
Large query results
2015 2016
900
300
0
1,200
コミットされたコード数
Google I/Oでのベータリリース
Dremel X
Big JOIN サポート
Dynamic Execution
Faster shuffle
100k qps ストリーミング
標準SQL
Table Partitioning
Capacitor
User-defined functions
Confidential & Proprietary
Google Cloud ベストプラクティス Google BigQuery
BigQuery Organization
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
Dataset (organization, access control)
Job (query, import, export, copy)
Project (billing, top-level container)
Table (data with schema)
Projects
● オブジェクトの Root Namespace
● 課金管理
● ユーザ管理
● ユーザ権限管理
● 1 つ以上の Dataset を持つ
● Job を持つ
● ACL ( Access Control List ) をもつ
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
Dataset (organization, access control)
Job (query, import, export, copy)
Project (billing, top-level container)
Table (data with schema)
Datasets
● TableやViewの集合を持つ
● データセットのすべての tables/viewsにアクセスコント
ロールが適用
● ACLsはReaders, Writers とOwners
Projectのメンバー以外にアクセス権を与えることが可
能
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
Dataset (organization, access control)
Job (query, import, export, copy)
Project (billing, top-level container)
Table (data with schema)
Tables
● 行と列の集合
○ マネージドストレージにデータ格納
● スキーマを持つ
○ カラムの値は強い型を記述
● Viewsをサポート
○ SQLクエリでVirtual tablesを定義
● テーブルは外部に持てる (federated)
○ Google Cloud Storage 等を直接クエリできる
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
Dataset (organization, access control)
Job (query, import, export, copy)
Project (billing, top-level container)
Table (data with schema)
Jobs
● すべての長時間実行される可能性があるものに使わ
れる
● Examples:
○ クエリ
○ データのインポート、エクスポート
○ データのコピー
● キャンセルできる
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
Jobs
$ bq ls -a -j
jobId Job Type State Start Time Duration
-------------------------------------------- ---------- --------- ----------------- ----------
job_WFk8LFLjxBABcv595_77PfRAPus query SUCCESS 29 May 15:30:02 0:00:00
job_lYDOJYrbdwKXwSxRpWh6QhfNWpE query SUCCESS 29 May 14:51:46 0:00:01
job_CzrUdmhK9a95wuIGPeDAObUe5dg query SUCCESS 29 May 09:57:12 0:00:00
● BigQuery は処理の単位をジョブとして管理
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
Jobs
● BigQuery は処理の単位をジョブとして管理
$ bq --format json show -j job_WFk8LFLjxBABcv595_77PfRAPus
{"status":{"state":"DONE"},"kind":"bigquery#job","statistics":{"query":{"cacheHit":true,"totalBytesP
rocessed":"0"},"endTime":"1432881002581","creationTime":"1432881002386","totalBytesProcessed":"0","s
tartTime":"1432881002509"},"jobReference":{"projectId":"fukudak-playground","jobId":"job_WFk8LFLjxBA
Bcv595_77PfRAPus"},"etag":""Gn3Hpo5WaKnpFuT457VBDNMgZBw/byQrtfxSXA8MpoOtROYPvCfyNmE"","user_email"
:"fukudak@google.com","configuration":{"query":{"useQueryCache":true,"destinationTable":{"projectId"
:"fukudak-playground","tableId":"anon656e2eb1f794dbeb3a4233962b14d8418e618b74","datasetId":"_ccf1fa0
a59a1479e1ec782cce6708e9edf3984dc"},"priority":"INTERACTIVE","writeDisposition":"WRITE_TRUNCATE","cr
eateDisposition":"CREATE_IF_NEEDED","query":"SELECTn count(*)nFROMn
[bigquery-samples:wikimedia_pageviews.201201];"}},"id":"fukudak-playground:job_WFk8LFLjxBABcv595_77P
fRAPus","selfLink":"https://www.googleapis.com/bigquery/v2/projects/fukudak-playground/jobs/job_WFk8
LFLjxBABcv595_77PfRAPus"}
Confidential & Proprietary
Google Cloud ベストプラクティス Google BigQuery
Exploring and Interacting
with BigQuery
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
ユーザ・インタフェース
● GUI BigQuery 管理コンソール(https://bigquery.cloud.google.com)
● CLI(bqコマンド)
● Cloud Datalab
● Google DataStudio
● API (RESTful API + 各種言語ライブラリ)
● 3rd パーティツール (Tableau, Qlikview, R, Simba ODBC driver,etc. )
Google Cloud ベストプラクティス:Google BigQuery 編 - 01 : BigQuery とは?
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
17 億件 (72.7GB) のフルスキャンが 6.7 秒!
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
$ bq query ‘select count(*) from
publicdata:samples.shakespeare’
コマンド
● Python ベースのコマンドラインツール
● Google Cloud SDK にバンドル (link)
● BigQuery コマンドの主な機能
○ cp : テーブルのコピー
○ extract : ファイル出力
○ insert : 行の挿入
○ load : ファイルのロード
○ query: クエリの実行
○ rm: テーブルの削除
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
# load
$ bq load dataset.table ./data.csv ./schema.json
# insert
$ bq insert dataset.table /tmp/mydata.json
# query
bq query ‘select count(*) from publicdata:samples.natality’
# extract
$ bq extract --destination_format=NEWLINE_DELIMITED_JSON
94949352.ga_sessions_20150930 gs://bucketname
コマンド
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
curl -H "$(python auth.py)" 
-H "Content-Type: application/json" 
-X POST 
-d {'jobReference': { 
'jobId': 'job_1429217599', 
'projectId': 'bigquery-e2e'}, 
'configuration': { 
'query': { 
'query': 'SELECT ...’}}} 
"https://www.googleapis.com/bigquery/v2/projects/bigquery-e2e/jobs"
API
● RESTful API
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
Google API Client Library
https://cloud.google.com/bigquery/client-libraries
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
https://cloud.google.com/bigquery/client-libraries
Google Apps Script
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
3rd パーティ製ツール
https://cloud.google.com/bigquery/partners/
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
Google DataStudio
Google Cloud ベストプラクティス Google BigQuery
Confidential & Proprietary
Cloud Datalab
Google BigQuery
Google Cloud ベストプラクティス
Thank you
1 : Introduction / BigQuery Organization / Exploring and Interacting with BigQuery
2 : Data ingestion into BigQuery / Writing Queries in BigQuery / Data extraction and exportation from BigQuery
3 : Best Practices and Performance Optimization / Cost Optimization
Google Cloud ベストプラクティス:Google BigQuery 編 - 01 : BigQuery とは?

More Related Content

PDF
[Cloud OnAir] BigQuery の仕組みからベストプラクティスまでのご紹介 2018年9月6日 放送
PDF
Mercari JPのモノリスサービスをKubernetesに移行した話 PHP Conference 2022 9/24
PDF
Google Cloud ベストプラクティス:Google BigQuery 編 - 02 : データ処理 / クエリ / データ抽出
PDF
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
PDF
Dockerからcontainerdへの移行
PDF
今だから知りたい BigQuery 再入門 | Google Cloud INSIDE Games & Apps: Online
PDF
Fluentdのお勧めシステム構成パターン
PDF
KafkaとAWS Kinesisの比較
[Cloud OnAir] BigQuery の仕組みからベストプラクティスまでのご紹介 2018年9月6日 放送
Mercari JPのモノリスサービスをKubernetesに移行した話 PHP Conference 2022 9/24
Google Cloud ベストプラクティス:Google BigQuery 編 - 02 : データ処理 / クエリ / データ抽出
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
Dockerからcontainerdへの移行
今だから知りたい BigQuery 再入門 | Google Cloud INSIDE Games & Apps: Online
Fluentdのお勧めシステム構成パターン
KafkaとAWS Kinesisの比較

What's hot (20)

PDF
Google Cloud ベストプラクティス:Google BigQuery 編 - 03 : パフォーマンスとコストの最適化
PDF
DeNA のデータ活用を支える BigQuery データの民主化とガバナンス強化の軌跡 | Google Cloud INSIDE Games & App...
PDF
君はyarn.lockをコミットしているか?
PPTX
MongoDBが遅いときの切り分け方法
PDF
マルチテナント化で知っておきたいデータベースのこと
PPTX
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)
PPTX
Amazon SageMakerでカスタムコンテナを使った学習
PDF
[Cloud OnAir] Cloud Data Fusion で GCP にデータを集約して素早く分析を開始しよう 2019年10月31日 放送
PPTX
分析指向データレイク実現の次の一手 ~Delta Lake、なにそれおいしいの?~(NTTデータ テクノロジーカンファレンス 2020 発表資料)
PDF
AWS Black Belt Online Seminar 2018 Amazon DynamoDB Advanced Design Pattern
PDF
DockerとPodmanの比較
PPTX
分散システムについて語らせてくれ
PDF
PFN のオンプレML基盤の取り組み / オンプレML基盤 on Kubernetes 〜PFN、ヤフー〜
PDF
DynamoDB設計のちょっとした技
PPTX
BigQuery Query Optimization クエリ高速化編
PDF
Snowflake Architecture and Performance
PPTX
AWSで作る分析基盤
PDF
20190806 AWS Black Belt Online Seminar AWS Glue
PDF
MonotaRO のデータ活用と基盤の過去、現在、未来
PDF
Amazon Athena 初心者向けハンズオン
Google Cloud ベストプラクティス:Google BigQuery 編 - 03 : パフォーマンスとコストの最適化
DeNA のデータ活用を支える BigQuery データの民主化とガバナンス強化の軌跡 | Google Cloud INSIDE Games & App...
君はyarn.lockをコミットしているか?
MongoDBが遅いときの切り分け方法
マルチテナント化で知っておきたいデータベースのこと
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)
Amazon SageMakerでカスタムコンテナを使った学習
[Cloud OnAir] Cloud Data Fusion で GCP にデータを集約して素早く分析を開始しよう 2019年10月31日 放送
分析指向データレイク実現の次の一手 ~Delta Lake、なにそれおいしいの?~(NTTデータ テクノロジーカンファレンス 2020 発表資料)
AWS Black Belt Online Seminar 2018 Amazon DynamoDB Advanced Design Pattern
DockerとPodmanの比較
分散システムについて語らせてくれ
PFN のオンプレML基盤の取り組み / オンプレML基盤 on Kubernetes 〜PFN、ヤフー〜
DynamoDB設計のちょっとした技
BigQuery Query Optimization クエリ高速化編
Snowflake Architecture and Performance
AWSで作る分析基盤
20190806 AWS Black Belt Online Seminar AWS Glue
MonotaRO のデータ活用と基盤の過去、現在、未来
Amazon Athena 初心者向けハンズオン
Ad

Similar to Google Cloud ベストプラクティス:Google BigQuery 編 - 01 : BigQuery とは? (20)

PDF
BigQuery 使ってみよう
PDF
BigQueryを始めてみよう - Google Analytics データを活用する
PDF
BigQueryを使ってみた(2018年2月)
PDF
[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送
PDF
BigQuery + Fluentd
PDF
これでBigQueryをドヤ顔で語れる!BigQueryの基本
PPTX
巨大なサービスと膨大なデータを支えるプラットフォーム

PDF
No-Ops で大量データ処理基盤
PDF
No-Ops で大量データ処理基盤を簡単に実現する
PDF
BigQueryの課金、節約しませんか
PDF
Google Analytics のデータ分析ハンズオン
PDF
ビッグデータとデータマート
PPTX
Google BigQueryのターゲットエンドポイントとしての利用
PPTX
BigQueryを活用したPrivate DMPを作って使ってるお話
PPTX
FutureTechNight_GoogleCloudデータ活用勉強会.pptx
PDF
[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送
PDF
[Cloud OnAir] BigQuery へデータを読み込む 2019年3月14日 放送
KEY
Google bigqueryとは
PDF
長期運用タイトルの GCP 移行実例とグレンジのこれから | Google Cloud INSIDE Games & Apps
PDF
Google BigQueryについて 紹介と推測
BigQuery 使ってみよう
BigQueryを始めてみよう - Google Analytics データを活用する
BigQueryを使ってみた(2018年2月)
[Cloud OnAir] 最新アップデート Google Cloud データ関連ソリューション 2020年5月14日 放送
BigQuery + Fluentd
これでBigQueryをドヤ顔で語れる!BigQueryの基本
巨大なサービスと膨大なデータを支えるプラットフォーム

No-Ops で大量データ処理基盤
No-Ops で大量データ処理基盤を簡単に実現する
BigQueryの課金、節約しませんか
Google Analytics のデータ分析ハンズオン
ビッグデータとデータマート
Google BigQueryのターゲットエンドポイントとしての利用
BigQueryを活用したPrivate DMPを作って使ってるお話
FutureTechNight_GoogleCloudデータ活用勉強会.pptx
[Cloud OnAir] BigQuery の一般公開データセットを 利用した実践的データ分析 2019年3月28日 放送
[Cloud OnAir] BigQuery へデータを読み込む 2019年3月14日 放送
Google bigqueryとは
長期運用タイトルの GCP 移行実例とグレンジのこれから | Google Cloud INSIDE Games & Apps
Google BigQueryについて 紹介と推測
Ad

More from Google Cloud Platform - Japan (20)

PDF
ServerlessDays Tokyo 2022 Virtual.pdf
PDF
20221105_GCPUG 女子会 Kubernets 編.pdf
PDF
Google Cloud でアプリケーションを動かす.pdf
PDF
[External] 2021.12.15 コンテナ移行の前に知っておきたいこと @ gcpug 湘南
PDF
What’s new in cloud run 2021 後期
PDF
【Dialogflow cx】はじめてみよう google cloud dialogflow cx 編
PDF
Google Cloud で実践する SRE
PDF
[Cloud OnAir] 事例紹介 : 株式会社マーケティングアプリケーションズ 〜クラウドへのマイグレーションとその後〜 2020年12月17日 放送
PDF
[Cloud OnAir] 【実演】Google Cloud VMware Engine と VMware ソリューションを組み合わせたハイブリッド環境の...
PDF
[Cloud OnAir] Google Workspace でできる データ分析と業務自動化のご紹介 2020年12月3日 放送
PDF
[Cloud OnAir] Google Cloud へのマイグレーション ツールの紹介 2020年11月26日 放送
PDF
[Cloud OnAir] Google Cloud における RDBMS の運用パターン 2020年11月19日 放送
PDF
[Cloud OnAir] 事例紹介: 株式会社オープンハウス 〜Google サービスを活用したオープンハウスの AI の取り組み〜 2020年11月1...
PDF
[Cloud OnAir] 【Anthos 演習】 解説を聞きながら Anthos を体験しよう 2020年11月5日 放送
PDF
[Cloud OnAir] 【Google Kubernetes Engine 演習】解説を聞きながら GKE を体験しよう 2020年10月29日 放送
PDF
[Cloud OnAir] Google Cloud の AI / IoT 最新事例紹介 2020年10月22日 放送
PDF
[Cloud OnAir] Google Cloud Next '20: OnAir 特別編 〜世界で人気のあったセッション特集〜 2020年9月24日 放送
PDF
[Cloud OnAir] Talks by DevRel Vol.5 アプリケーションのモダナイゼーション 2020年9月3日 放送
PDF
明日から役立つ BigQuery ML 活用 5 つのヒント | Google Cloud INSIDE Games & Apps: Online
PDF
『MAGELLAN BLOCKS』を使って BigQuery を使い倒す!| Google Cloud INSIDE Games & Apps: Online
ServerlessDays Tokyo 2022 Virtual.pdf
20221105_GCPUG 女子会 Kubernets 編.pdf
Google Cloud でアプリケーションを動かす.pdf
[External] 2021.12.15 コンテナ移行の前に知っておきたいこと @ gcpug 湘南
What’s new in cloud run 2021 後期
【Dialogflow cx】はじめてみよう google cloud dialogflow cx 編
Google Cloud で実践する SRE
[Cloud OnAir] 事例紹介 : 株式会社マーケティングアプリケーションズ 〜クラウドへのマイグレーションとその後〜 2020年12月17日 放送
[Cloud OnAir] 【実演】Google Cloud VMware Engine と VMware ソリューションを組み合わせたハイブリッド環境の...
[Cloud OnAir] Google Workspace でできる データ分析と業務自動化のご紹介 2020年12月3日 放送
[Cloud OnAir] Google Cloud へのマイグレーション ツールの紹介 2020年11月26日 放送
[Cloud OnAir] Google Cloud における RDBMS の運用パターン 2020年11月19日 放送
[Cloud OnAir] 事例紹介: 株式会社オープンハウス 〜Google サービスを活用したオープンハウスの AI の取り組み〜 2020年11月1...
[Cloud OnAir] 【Anthos 演習】 解説を聞きながら Anthos を体験しよう 2020年11月5日 放送
[Cloud OnAir] 【Google Kubernetes Engine 演習】解説を聞きながら GKE を体験しよう 2020年10月29日 放送
[Cloud OnAir] Google Cloud の AI / IoT 最新事例紹介 2020年10月22日 放送
[Cloud OnAir] Google Cloud Next '20: OnAir 特別編 〜世界で人気のあったセッション特集〜 2020年9月24日 放送
[Cloud OnAir] Talks by DevRel Vol.5 アプリケーションのモダナイゼーション 2020年9月3日 放送
明日から役立つ BigQuery ML 活用 5 つのヒント | Google Cloud INSIDE Games & Apps: Online
『MAGELLAN BLOCKS』を使って BigQuery を使い倒す!| Google Cloud INSIDE Games & Apps: Online

Google Cloud ベストプラクティス:Google BigQuery 編 - 01 : BigQuery とは?

  • 1. Confidential & Proprietary Google BigQueryIntroduction / BigQuery Organization / Exploring and Interacting with BigQuery Google Cloud カスタマーエンジニア Google Cloud ベストプラクティス
  • 2. Confidential & Proprietary Agenda ● Introduction ● BigQuery Organization ● Exploring and Interacting with BigQuery Google Cloud ベストプラクティス Google BigQuery ※このスライドは 2017 年 12 月時点の情報に基づき作成しています。最新情報は Google Cloud Platform のドキュメントをご参照ください。  https://cloud.google.com/docs/
  • 3. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary ● 億件レベルの大規模データセットに対する高速クエリ ● 分析用のデータウェアハウス ○ UPDATE, DELETE, INSERT は制限あり ● セットアップ、パフォーマンスチューニングやクラスタ拡張といったイ ンフラ作業不要 ● ストレージ容量無制限。自動スケールアウト Google BigQuery とは
  • 4. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary ● BI ツールを使って非技術者でも操作可能 ○ Tableau, QlickView, Google DataStudio, Google Spreadsheet / Microsoft Excel (ODBC, JDBC) ● ETL ○ クエリ結果をテーブルに出力可能 ○ JSON 関数/正規表現関数 ● データ処理エンジンとの連携 ○ Cloud Dataflow, Cloud Dataproc, Hadoop Google BigQuery とは
  • 5. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary BigQuery ログ収集/分析基盤 Cloud Logging App Engine Analytics Server Google Analytics Compute Engine On-premise / 他社クラウド Google Spreadsheet Stream API File 3rd party tools Simba ODBC Driver Google BigQuery 参考構成
  • 6. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary 5 年間における絶え間ないイノベーション 2010 2011 2012 2013 2014 一般公開 Large query results 2015 2016 900 300 0 1,200 コミットされたコード数 Google I/Oでのベータリリース Dremel X Big JOIN サポート Dynamic Execution Faster shuffle 100k qps ストリーミング 標準SQL Table Partitioning Capacitor User-defined functions
  • 7. Confidential & Proprietary Google Cloud ベストプラクティス Google BigQuery BigQuery Organization
  • 8. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary Dataset (organization, access control) Job (query, import, export, copy) Project (billing, top-level container) Table (data with schema) Projects ● オブジェクトの Root Namespace ● 課金管理 ● ユーザ管理 ● ユーザ権限管理 ● 1 つ以上の Dataset を持つ ● Job を持つ ● ACL ( Access Control List ) をもつ
  • 9. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary Dataset (organization, access control) Job (query, import, export, copy) Project (billing, top-level container) Table (data with schema) Datasets ● TableやViewの集合を持つ ● データセットのすべての tables/viewsにアクセスコント ロールが適用 ● ACLsはReaders, Writers とOwners Projectのメンバー以外にアクセス権を与えることが可 能
  • 10. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary Dataset (organization, access control) Job (query, import, export, copy) Project (billing, top-level container) Table (data with schema) Tables ● 行と列の集合 ○ マネージドストレージにデータ格納 ● スキーマを持つ ○ カラムの値は強い型を記述 ● Viewsをサポート ○ SQLクエリでVirtual tablesを定義 ● テーブルは外部に持てる (federated) ○ Google Cloud Storage 等を直接クエリできる
  • 11. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary Dataset (organization, access control) Job (query, import, export, copy) Project (billing, top-level container) Table (data with schema) Jobs ● すべての長時間実行される可能性があるものに使わ れる ● Examples: ○ クエリ ○ データのインポート、エクスポート ○ データのコピー ● キャンセルできる
  • 12. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary Jobs $ bq ls -a -j jobId Job Type State Start Time Duration -------------------------------------------- ---------- --------- ----------------- ---------- job_WFk8LFLjxBABcv595_77PfRAPus query SUCCESS 29 May 15:30:02 0:00:00 job_lYDOJYrbdwKXwSxRpWh6QhfNWpE query SUCCESS 29 May 14:51:46 0:00:01 job_CzrUdmhK9a95wuIGPeDAObUe5dg query SUCCESS 29 May 09:57:12 0:00:00 ● BigQuery は処理の単位をジョブとして管理
  • 13. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary Jobs ● BigQuery は処理の単位をジョブとして管理 $ bq --format json show -j job_WFk8LFLjxBABcv595_77PfRAPus {"status":{"state":"DONE"},"kind":"bigquery#job","statistics":{"query":{"cacheHit":true,"totalBytesP rocessed":"0"},"endTime":"1432881002581","creationTime":"1432881002386","totalBytesProcessed":"0","s tartTime":"1432881002509"},"jobReference":{"projectId":"fukudak-playground","jobId":"job_WFk8LFLjxBA Bcv595_77PfRAPus"},"etag":""Gn3Hpo5WaKnpFuT457VBDNMgZBw/byQrtfxSXA8MpoOtROYPvCfyNmE"","user_email" :"fukudak@google.com","configuration":{"query":{"useQueryCache":true,"destinationTable":{"projectId" :"fukudak-playground","tableId":"anon656e2eb1f794dbeb3a4233962b14d8418e618b74","datasetId":"_ccf1fa0 a59a1479e1ec782cce6708e9edf3984dc"},"priority":"INTERACTIVE","writeDisposition":"WRITE_TRUNCATE","cr eateDisposition":"CREATE_IF_NEEDED","query":"SELECTn count(*)nFROMn [bigquery-samples:wikimedia_pageviews.201201];"}},"id":"fukudak-playground:job_WFk8LFLjxBABcv595_77P fRAPus","selfLink":"https://www.googleapis.com/bigquery/v2/projects/fukudak-playground/jobs/job_WFk8 LFLjxBABcv595_77PfRAPus"}
  • 14. Confidential & Proprietary Google Cloud ベストプラクティス Google BigQuery Exploring and Interacting with BigQuery
  • 15. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary ユーザ・インタフェース ● GUI BigQuery 管理コンソール(https://bigquery.cloud.google.com) ● CLI(bqコマンド) ● Cloud Datalab ● Google DataStudio ● API (RESTful API + 各種言語ライブラリ) ● 3rd パーティツール (Tableau, Qlikview, R, Simba ODBC driver,etc. )
  • 17. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary 17 億件 (72.7GB) のフルスキャンが 6.7 秒!
  • 18. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary $ bq query ‘select count(*) from publicdata:samples.shakespeare’ コマンド ● Python ベースのコマンドラインツール ● Google Cloud SDK にバンドル (link) ● BigQuery コマンドの主な機能 ○ cp : テーブルのコピー ○ extract : ファイル出力 ○ insert : 行の挿入 ○ load : ファイルのロード ○ query: クエリの実行 ○ rm: テーブルの削除
  • 19. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary # load $ bq load dataset.table ./data.csv ./schema.json # insert $ bq insert dataset.table /tmp/mydata.json # query bq query ‘select count(*) from publicdata:samples.natality’ # extract $ bq extract --destination_format=NEWLINE_DELIMITED_JSON 94949352.ga_sessions_20150930 gs://bucketname コマンド
  • 20. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary curl -H "$(python auth.py)" -H "Content-Type: application/json" -X POST -d {'jobReference': { 'jobId': 'job_1429217599', 'projectId': 'bigquery-e2e'}, 'configuration': { 'query': { 'query': 'SELECT ...’}}} "https://www.googleapis.com/bigquery/v2/projects/bigquery-e2e/jobs" API ● RESTful API
  • 21. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary Google API Client Library https://cloud.google.com/bigquery/client-libraries
  • 22. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary https://cloud.google.com/bigquery/client-libraries Google Apps Script
  • 23. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary 3rd パーティ製ツール https://cloud.google.com/bigquery/partners/
  • 24. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary Google DataStudio
  • 25. Google Cloud ベストプラクティス Google BigQuery Confidential & Proprietary Cloud Datalab
  • 26. Google BigQuery Google Cloud ベストプラクティス Thank you 1 : Introduction / BigQuery Organization / Exploring and Interacting with BigQuery 2 : Data ingestion into BigQuery / Writing Queries in BigQuery / Data extraction and exportation from BigQuery 3 : Best Practices and Performance Optimization / Cost Optimization