使用R在postgres中设置架构名称 [英] Setting the schema name in postgres using R

查看:75
本文介绍了使用R在postgres中设置架构名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用R连接到PostgreSQL数据库。使用以下功能完成连接:

I am using R to connect to a PostgreSQL database. Connection is done using below function:

dbConnect(m, dbname=dbname, host=host, port=port, user=user, password=password)

m 是驱动程序(postgres)。

m is the driver (postgres).

但是它不允许我设置表所使用的特定架构名称。如何连接到特定的模式,以便每次不必在表名之前添加模式名?

But it does not allow me to set a particular schema name under which my tables are. How do I connect to a particular schema so that every time I don't have to prefix schema name to the table names?

R中是否有与 set search_path ='myschema'

推荐答案

您可以使用:

dbConnect(
  m,
  dbname=dbname,
  host=host,
  port=port,
  user=user,
  password=password,
  options="-c search_path=myschema"
)

它与 RPostgreSQL 以及 RPostgres

这篇关于使用R在postgres中设置架构名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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