BigQuery命令'bq mk'引发错误“ mk操作中的BigQuery错误:读取架构时出错:”

时间:2019-12-24 07:48:59

标签: google-cloud-platform google-bigquery

我是BigQuery的新手,我试图使用BASH文件创建BigQuery表,该文件是从Cloud Shell运行的。该文件包含以下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

有什么解决方案?预先感谢。

1 个答案:

答案 0 :(得分:0)

在第一个命令中,您将JSON文件定义为temp_schema.json,但是在第二个bq mk命令中,您将其命名为myschema.json,我相信您应该指出改为myschema.json的位置。