【发布时间】:2019-10-02 09:52:07
【问题描述】:
我们正在将 Firestore 数据导入 BigQuery,以便在 Data Studio 中生成报告。
以下适用于 SQL 时间戳,但不适用于 Firestore-JSON 时间戳。
SELECT
PARSE_TIMESTAMP('%Y%m%d', JSON_VALUE(`data`, "$.updated_at")) AS `updated_at`
FROM
`project.firestore_export.profiles_raw_latest`
我们的日期在名为 updated_at 的 JSON 字段中的 data 列中采用 Firestore timestamp 格式。
如何获得最终在 Data Studio 中使用的可用日期格式?
编辑:当我查询没有 JSON_VALUE 的字段时,它返回为 null,这是 Firestore 中的标准时间戳格式。当我在 BigQuery 中预览数据时,它会以 JSON 对象的形式返回:{"_seconds":1569585420,"_nanoseconds":586000000}
【问题讨论】:
-
你能分享一个例子吗?
-
@GrahamPolley 当我查询没有
JSON_VALUE的字段时,它返回null,这是Firestore 中的标准时间戳格式。当我在 BigQuery 中预览数据时,它会以 JSON 对象的形式返回:{"_seconds":1569585420,"_nanoseconds":586000000}
标签: sql google-cloud-firestore google-bigquery google-data-studio