【问题标题】:Access Redshift tables under a schema访问模式下的 Redshift 表
【发布时间】:2018-07-23 15:42:34
【问题描述】:

我正在尝试使用模式下的 shinyR 访问 Redshift 上的一些表,我可以使用 library(RPostgresSQL) 连接到不在模式下的表,所以我知道这部分正在工作:

pconn_r <- dbConnect(RPostgres::Postgres(),  
                 host = "xxxxxxxxxxxx",
                 port = "5439",
                 user = "rcd_admin",
                 password = "xxxxxxx",
                 dbname = "xxxx" 

)

但我无法使用此命令访问架构 synapps 下的表 fr__synapps_drug__outpatient_index:

sql_command <- "Select cip13_code,cis_label,presentation_label,brand,period,hco_code,hco_label,hco_code_type,hco_city,bse,rem,unit from  synapps.fr__synapps_drug__outpatient_index"
outpatient <- dbSendQuery(pconn_r, sql_command)

【问题讨论】:

  • 看起来您缺少 fetch 语句。 output_data
  • 然后我无法访问数据...不太清楚。请发布您收到的错误或不想要的结果。
  • fr__synapps_drug__outpatient_index 是表还是索引?
  • @MikeSherrill'CatRecall' 数据库是oip,架构是synapps,这个架构下的表是fr__synapps_drug__outpatient_index

标签: r postgresql amazon-redshift shiny-reactivity


【解决方案1】:

我找到了解决办法:

myRedshift <- DBI::dbConnect(RPostgreSQL::PostgreSQL(), 
                         dbname = 'oip',
                         host = 'xxxx',
                         port = 5439,
                         user = "xxxadmin", 
                         password = "xxx")

cis_has_bdpm <-data.frame( dbGetQuery(myRedshift, "select * from synapps.fr__synapps_drug__has_index"))

我改变了连接 Redshift 的方式,它正在工作,但是数据的加载很慢

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-22
    • 2014-06-16
    • 2017-11-03
    • 1970-01-01
    相关资源
    最近更新 更多