【发布时间】:2019-12-24 07:48:59
【问题描述】:
我是 BigQuery 的新手,我正在尝试使用从 Cloud Shell 运行的 BASH 文件创建 BigQuery 表。该文件包含以下bq mk 命令:
bq mk --table project_id:dataset_name.table_name /home/bhagesharora/temp_schema.json
temp_schema.json的内容:
[
{
"description": "quarter",
"mode": "REQUIRED",
"name": "qtr",
"type": "STRING"
},
{
"description": "sales representative",
"mode": "NULLABLE",
"name": "rep",
"type": "STRING"
},
{
"description": "total sales",
"mode": "NULLABLE",
"name": "sales",
"type": "FLOAT"
}
]
我使用following 文档和命令作为参考:
bq mk --table mydataset.mytable ./myschema.json
我得到的完整错误是:
BigQuery error in mk operation: Error reading schema: "/home/bhagesharora/temp_schema.json
" looks like a filename, but was not found.
bq_create_eventTables.sh: line 2: $'\r': command not found
bq_create_eventTables.sh: line 3: $'\r': command not found
bq_create_eventTables.sh: line 4: $'\r': command not found
bq_create_eventTables.sh: line 5: $'\r': command not found
解决办法是什么?提前致谢。
【问题讨论】:
-
你能发布 cat
/home/bhagesharora/temp_schema.json返回的内容吗?它可能不存在或 BQ 实用程序没有读取权限。 -
我可以读取 JSON 文件 aror031@cloudshell:~$ cat /home/bhagesharora/temp_schema.json [ { "description": "quarter", "mode": "REQUIRED", "name ": "qtr", "type": "STRING" }, { "description": "销售代表", "mode": "NULLABLE", "name": "rep", "type": "STRING" }, { “描述”:“总销售额”,“模式”:“NULLABLE”,“名称”:“销售额”,“类型”:“FLOAT”} ]
标签: google-cloud-platform google-bigquery