简体   繁体   English

无法从外部表(链接的Google驱动器文件)查询工作,无法在python中工作

[英]Query job doesn't work from external table (linked google drive file) doesn't work in python

I'm learning python with bigquery by doing small project and I have no idea why my query doesn't work in python while working properly in bigquery web gui. 我正在通过做一个小项目来用bigquery学习python,但我不知道为什么在bigquery web gui中正常工作时,我的查询为什么不能在python中工作。 If I'm running any other queries from standard dataset tables it works. 如果我正在运行来自标准数据集表的任何其他查询,那么它将起作用。 I've added google drive scoopes to default credentials because I had auth error before. 我已将google驱动器信息添加到默认凭据中,因为之前我曾遇到过验证错误。 Just external table from google drive is not working and I'm getting error 只是来自Google驱动器的外部表无法正常工作,并且出现错误

google.cloud.exceptions.InternalServerError: 500 Error encountered during execution. google.cloud.exceptions.InternalServerError:500执行期间遇到错误。 Retrying may solve the problem. 重试可能会解决问题。

My standard google function: 我的标准Google功能:

def query_shakespeare(query):

    client = bigquery.Client()
    job_name = str(uuid.uuid4())
    query_job = client.run_async_query(job_name, query)

    query_job.begin()
    query_job.result()

    destination_table = query_job.destination
    destination_table.reload()
    for row in destination_table.fetch_data():
        print(row)

And my query looks like this: 我的查询如下所示:

SELECT * FROM [gdocs_names.name_0001]

Running it by web -> compose query last 3s and works. 通过网络运行->最后3秒钟编写查询即可正常工作。 It works also using command line: 它也可以通过命令行使用:

bg query "SELECT * FROM [gdocs_names.name_0001]"

我花了很多时间,有一个标志--enable_gdrive需要设置为true,如下所示:

bg query --enable_gdrive=true "SELECT * FROM [gdocs_names.name_0001]"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM