我对数据库和 Redshift 都比较陌生,我想使用 R Studio 中的Connections来查询一组数据库以提取数据子集。
具体问题:在 Redshift 中连接到正确的数据库后,我该如何指定子数据库及其使用的表dbplyr
?
主数据库是production
,其中有几个子数据库 (?),例如customerdb
、supplierdb
、membersdb
..,每个子数据库都有几个表。假设我想将表companies
中的数据子集化customerdb
,我试图通过以下方式做到这一点:
# `con` is the connection to Redshift database via DBI and it connects successfully
dataset <- tbl(con, "customerdb.companies")
Error in new_result(connection@ptr, statement) :
nanodbc/nanodbc.cpp:1344: 42P01: [Amazon][Amazon Redshift] (30)
Error occurred while trying to execute a query: [SQLState 42P01]
ERROR: relation "customerdb.companies" does not exist
查看了各种资源,从 AWS 到 dbplyr 的页面,以及其他 SO 问题,似乎都没有显示这种设置样式或连接到基础表的方法。