问题描述
这是我在另一篇文章中遇到工作流程问题的延续。经过进一步调试后,我意识到大查询工作流中的“last_modified_time”没有显示正确的结果,但在大查询 UI 中执行它时同样可以正常工作。请参阅以下详细信息。 Google Cloud Workflow error as "Syntax error: Unclosed string literal
下面是我的工作流代码,只是为了看看“last_modified_time”的值是什么
main:
steps:
- getupdatedatetime:
call: googleapis.bigquery.v2.jobs.query
args:
projectId: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
body:
useLegacysql: false
query: >
SELECT
TIMESTAMP_MILLIS(last_modified_time) AS last_modified_time,DATE(TIMESTAMP_MILLIS(creation_time)) AS creation_date,FROM `project-dataset.__TABLES__` where table_id='table_name'
result: queryResult
- documentFound:
return: ${queryResult}
{
"cacheHit": false,"jobComplete": true,"jobReference": {
"jobId": "job__EmSzEzxnuAKBTebWTieYIQVNKf7","location": "EU","projectId": "project_id"
},"kind": "bigquery#queryResponse","rows": [
{
"f": [
{
**"v": "1.625481329263E9"**
},{
"v": "2021-07-05"
}
]
}
],"schema": {
"fields": [
{
"mode": "NULLABLE","name": "last_modified_time","type": "TIMESTAMP"
},{
"mode": "NULLABLE","name": "creation_date","type": "DATE"
}
]
},"totalBytesProcessed": "0","totalRows": "1"
}
last_modified_time 不正确。创建日期很好。因为 last_modified_time 在这里不好。我的工作流中的其他子工作流无法正常工作。
SELECT
TIMESTAMP_MILLIS(last_modified_time) AS last_modified_time,FROM `project.dataset.__TABLES__` where table_id='table_name'
谁能为我做错的事情提供一些帮助和指导。
解决方法
您的工作流程的结果是正确的。时间戳是一个整数。在 BQ UI 中,时间戳被转换为 DateTime 格式。您可以根据需要将 last_modified_time
时间戳值转换为 DateTime 格式。
我使用 https://www.epochconverter.com/ 将您的时间戳结果转换为 DateTime 格式,结果如下:GMT: Monday,July 5,2021 10:35:29.263
。