我的R(v。3.1.1)dplyr(v。0.3.0.2)可以访问我的POSTGRES 9.3.5 TABLE,但不能访问同一数据库中的VIEW。
dplyr是否支持访问POSTGRES 9.3.5 VIEW?
在POSTGRES中,我的VIEW定义如下:
centralstats=# \d "nicStats5"
View "public.nicStats5"
Column | Type | Modifiers
--------------+-------------------+-----------
affectedId | integer |
timeRecorded | bigint |
dn | character varying |
bytesRx | bigint |
Run Code Online (Sandbox Code Playgroud)
查看定义:
SELECT "adaptorNICVnicStats"."affectedId",
"adaptorNICVnicStats"."timeRecorded",
"affectedId2Dn".dn,
"adaptorNICVnicStats"."bytesRx"
FROM "adaptorNICVnicStats",
"affectedId2Dn"
WHERE "adaptorNICVnicStats"."affectedId" = "affectedId2Dn"."affectedId";
Run Code Online (Sandbox Code Playgroud)
IN R可以从dplyr访问定义了我的VIEW的所有数据库。并且访问我的VIEW失败,如下所示:
centralstats <- src_postgres("centralstats",host = NULL, port = NULL,"postgres","Jmu2014!")
adaptorNICVnicStats <-tbl(centralstats, "adaptorNICVnicStats")
affectedId2Dn <-tbl(centralstats, "affectedId2Dn")
nicStats5 <-tbl(centralstats, "nicStats5")
## Fejl: Table nicStats5 not found in database //* COMMENT: "Fejl" is the …Run Code Online (Sandbox Code Playgroud)