我在用
RPostgres
包连接到aws redshift,从redshift数据库的表中读取数据,在r中执行一些分析,并将输出写回redshift。
我能毫无问题地阅读数据。但在将表写回redshift时,我收到一个错误:
这是一个示例代码:
library("RPostgres")
conn <- tryCatch(dbConnect(RPostgres::Postgres(),
host = 'localhost',
port = 5429,
user = 'username',
password = 'password',
dbname = 'my_db',
sslmode='require'), error = function(e) NULL)
df <- dbGetQuery(conn, 'select * from my_table')
output_df <- output
dbWriteTable(conn, 'my_output_table', output_df, row.names=FALSE, append=FALSE)
结果创建错误(conn@ptr,语句):未能准备
查询:错误:函数generate_subscripts(name[],integer)不
exist提示:没有函数与给定的名称和参数类型匹配。
您可能需要添加显式类型转换。
我可以读取表并进行分析,但不能将分析的输出写回redshift。
my_output_table
已经是在redshift中创建的表。