dplyr& monetdb - 查询schema.table的适当语法? [英] dplyr & monetdb - appropriate syntax for querying schema.table?

查看:229
本文介绍了dplyr& monetdb - 查询schema.table的适当语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

monetdb 我已经设置了一个模式 main ,我的表被创建到这个模式中。

In monetdb I have set up a schema main and my tables are created into this schema.

例如,部门表是 main.department

使用 dplyr 我尝试查询表:

mdb <- src_monetdb(dbname="model", user="monetdb", password="monetdb")

tbl(mdb, "department")

但我得到

Error in .local(conn, statement, ...) : 
  Unable to execute statement 'PREPARE SELECT * FROM "department"'.
Server says 'SELECT: no such table 'department'' [#42S02].

我试图使用main.department和其他类似的组合,没有运气。

I tried to use "main.department" and other similar combinations with no luck.

什么是适当的语法?

推荐答案

有一个有点黑客的解决方法:我们可以手动设置连接的默认模式。我有一个数据库测试,其中有一个模式 foo ,表格名为 bar

There is a somewhat hacky workaround for this: We can manually set the default schema for the connection. I have a database testing, in there is a schema foo with a table called bar.

mdb <- src_monetdb("testing")
dbSendQuery(mdb$con, "SET SCHEMA foo");
t <- tbl(mdb, "bar")

这篇关于dplyr&amp; monetdb - 查询schema.table的适当语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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