无法使用标准sql的bigrquery [英] Unable to use bigrquery with standard sql

查看:291
本文介绍了无法使用标准sql的bigrquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个R ipython笔记本(相对R新手)中工作,并尝试使用'bigrquery'从Google Big Query中提取数据。我被告知这应该很简单,但使用标准sql提取不起作用。

I'm working in an R ipython notebook (relative R newbie) and trying to extract data from Google Big Query using 'bigrquery'. I'm told this should be simple, but extracting using standard sql isn't working.

这是我的代码:

require("bigrquery")

# Use your project ID here
project <- "project-id" # put your project ID here

standard_sql <- "SELECT year, month, day, weight_pounds FROM `publicdata.samples.natality` LIMIT 5"

legacy_sql <- "SELECT year, month, day, weight_pounds FROM [publicdata:samples.natality] LIMIT 5"

# doesn't work
standard_data <- query_exec(standard_sql, project = project, useLegacySql = FALSE)

# works
legacy_data <- query_exec(legacy_sql, project = project, useLegacySql = TRUE)

对于上面的标准sql,它返回以下错误:

For the standard sql above it returns the following error:

Error: Invalid table name: `publicdata:samples.natality`
Traceback:

1. query_exec(standard_sql, project = project, useLegacySql = FALSE)
2. run_query_job(query = query, project = project, destination_table = destination_table, 
 .     default_dataset = default_dataset, create_disposition = create_disposition, 
 .     write_disposition = write_disposition, use_legacy_sql = use_legacy_sql, 
 .     quiet = quiet, ...)
3. wait_for(job, quiet = quiet)
4. stop(err$message, call. = FALSE)

这表明我没有为标准SQL正确输入表名,但我看起来有,并且查询可以在GBQ控制台中正常运行。

It's suggesting that I've not entered the table name correctly for standard SQL, but I seemingly have and the query runs fine from the GBQ console.

发生了什么问题?

What's going wrong?

推荐答案

它应该是 use_legacy_sql = FALSE 而不是 useLegacySql 。他们在提交新代码后立即更改了变量名称。

It should be use_legacy_sql = FALSE instead of useLegacySql. They changed the variable name right after committing the new code.

这篇关于无法使用标准sql的bigrquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆