将RStudio与Bigquery一起使用的新功能-无法识别嵌套表
我有以下没有运行。我收到错误“无效表名:将RStudio与Bigquery一起使用的新功能-无法识别嵌套表,r,google-bigquery,R,Google Bigquery,我有以下没有运行。我收到错误“无效表名:tk.events.*”。此表是嵌套的,但我使用的列不是(每行1个值) 当我将下面的查询替换为另一个未列出的表时,它会按预期运行。我是否可以对格式进行某种更改以解决此问题 project <- "my-project-765" # put your project ID here sql <- paste(" #standardSQL select userID, cast(dateti
tk.events.*
”。此表是嵌套的,但我使用的列不是(每行1个值)
当我将下面的查询替换为另一个未列出的表时,它会按预期运行。我是否可以对格式进行某种更改以解决此问题
project <- "my-project-765" # put your project ID here
sql <- paste("
#standardSQL
select
userID,
cast(datetime(servertimestamp,'America/Vancouver') as date) as loginDate
FROM `tk.events_*`
where _table_suffix between '20170802' and '20180803'
and ( eventType like '%Viewed' or eventType ='LoginSucceeded')
group by userId, loginDate
",
sep ="")
df <- query_exec(query=sql, project=project, destination_table = "reports.UserLoginTable_copy", write_disposition = "WRITE_APPEND" , max_pages = 1, useLegacySql = 'f') ## run query and store in dataframe
我最好的猜测是,由于某种原因,标准SQL没有被激活 尝试运行此命令,可能会起作用:
df <- query_exec(query=sql, project=project, destination_table = "reports.UserLoginTable_copy", write_disposition = "WRITE_APPEND" , max_pages = 1, use_legacy_sql = FALSE)
df只是想知道,如果运行相同的查询,但是使用tk.events\u 20170802
作为表,会发生什么?工作正常吗?不幸的是,仍然列为无效表名。谢谢-看起来我使用了“useLegacySql”而不是“use_legacy_sql”,并根据您的示例将其设置为字符串('false'),而不是布尔值。
df <- query_exec(query=sql, project=project, destination_table = "reports.UserLoginTable_copy", write_disposition = "WRITE_APPEND" , max_pages = 1, use_legacy_sql = FALSE)