我最近在使用 Python API 时收到以下 BigQuery 错误:
google.api_core.exceptions.BadRequest:无法为脚本设置 400 configuration.query.destinationTable
这是我使用的功能:
def execute_bigquery_sql(query, dataset_id, table_id, use_legacy_sql=True, write_disposition='WRITE_TRUNCATE'):
client = bigquery.Client()
job_config = bigquery.QueryJobConfig()
job_config.use_legacy_sql = use_legacy_sql
print("table_id: {table_id}".format(table_id=table_id))
print("dataset_id: {dataset_id}".format(dataset_id=dataset_id))
if table_id:
table_ref = client.dataset(dataset_id).table(table_id)
print("table_ref: {table_ref}".format(table_ref=table_ref))
job_config.destination = table_ref
job_config.write_disposition = write_disposition
job_config.allow_large_results = True
job_config.createDisposition = "CREATE_IF_NEEDED"
query_job = client.query(query,job_config=job_config)
results = query_job.result() # Waits for job to complete.
Run Code Online (Sandbox Code Playgroud)
有谁知道可能会发生什么和解决方法?
如果我有
footnotes = { "apple" => "is a fruit", "cat" => "is an animal", "car" => "a transport"}
Run Code Online (Sandbox Code Playgroud)
我如何得到这些的索引?,如:
footnotes["cat"].index
# => 1
Run Code Online (Sandbox Code Playgroud) 如何在Ruby中求和
[1, 2, nil, 4]
Run Code Online (Sandbox Code Playgroud)
同
[nil, 2, nil, 4]
Run Code Online (Sandbox Code Playgroud)
并有
[1, 4, nil, 8]
Run Code Online (Sandbox Code Playgroud)
?