1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

BigQueryに保存されているJSONから値を取り出す[超個人的メモ]

Posted at

BigQueryにJSONを保存したり、保存したJSONを読みこむクエリがある。毎回忘れてしまうのでメモ。

例えばBigQueryで、

もし、fooテーブルの中のbarカラムが以下のようなjsonだった場合

bar
{“baz”:  true}
{“foobar”: true}
{“bad”: true}

JSONを読み込むためのクエリ
SELECT JSON_QUERY(bar, '$.displayed') AS json_text_string FROM foo LIMIT 1000

true
null
true

のように、jsonの中のbarを取り出す事が出来た。

詳しくは公式ドキュメントを参照
https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions?hl=ja#json_extract

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?