我正在尝试通过从 Google Drive 读取文件来创建 BigQuery 外部表 - 它适用于内联方案,但因autodetect
标志而失败。
参考文档:
https ://cloud.google.com/bigquery/external-data-drive
架构文件:
$ bq mkdef --autodetect --source_format=CSV "https://drive.google.com/open?id=<file-id>" > schema.json
模式.json:
{
"autodetect": true,
"csvOptions": {
"encoding": "UTF-8",
"quote": "\""
},
"sourceFormat": "CSV",
"sourceUris": [
"https://drive.google.com/open?id=<file-id>"
]
}
外部表:
$ bq mk --external_table_definition=schema.json mydataset.mytable
BigQuery error in mk operation: Access Denied: BigQuery BigQuery: No OAuth token with Google Drive scope was found.
它适用于内联模式:
$ bq mk --external_table_definition=col1:INTEGER,col2:STRING@CSV=https://drive.google.com/open?id=<file-id> mydataset.mytable
Table 'myproject:mydataset.mytable' successfully created.
注意:我已通过使用启用 Google Drive 访问
gcloud auth login --enable-gdrive-access