BigQuery load_table_from_storage将无法识别uri

时间:2016-12-21 21:36:58

标签: python google-bigquery google-cloud-storage

尝试从Google云端存储加载表时遇到以下错误: BadRequest:400 Load配置必须至少指定一个源URI(POST https://www.googleapis.com/bigquery/v2/projects/fansidata/jobs

同时我的uri有效(即:我可以在gcs网络应用程序中看到它)

uris = ['gs://my-bucket-name/datastore_backup_analytics_2016_12_21_2_User/1569751766512529035929A5AA9742/output-0']

job_name = 'Load_User' 
destinationTable = dataset.table('Transfer')
job = bigquery_client.load_table_from_storage(job_name, destinationTable, uris)            
job.begin()

2 个答案:

答案 0 :(得分:2)

我可能错了,但看起来Python API中的*期望第三个参数的单个字符串而不是列表。如果要匹配多个文件,最后可以使用uri = 'gs://my-bucket-name/datastore_backup_analytics_2016_12_21_2_User/1569751766512529035929A5AA9742/output-*'] job_name = 'Load_User' destinationTable = dataset.table('Transfer') job = bigquery_client.load_table_from_storage(job_name, destinationTable, uri) job.begin() 。例如,

Dim forbiddenWordsArr As Variant
Dim forbiddenWords As String

forbiddenWordsArr= Array("and","or","big","small","whatever else you want to add")
forbiddenWords="|" & Join(forbiddenWordsArr,"|"), & "|"
For i = 0 To UBound(words, 1)
    Select Case True
        Case = Len(words(i))<3 or InStr(forbiddenWords, "|" & words(i) & "|") > 0

        Case Else

   ...

答案 1 :(得分:1)

Client.load_table_from_storage使用一个或多个源URI(这是*soure_uris在python中的含义)。 E.g:

job = client.load_table_from_storage(
    'load-job-123', my_table_object,
    'gs://my-bucket-name/table_one',
    'gs://my-bucket-name/table_two')