我是通过R连接到Redshift的新手,我已经阅读了其他问题,但尝试创建表格时仍遇到错误。 我已经成功地建立了一个连接,我想建立成功的表:Redshift with R
redshiftcon <- dbConnect(mm, user="username", password="secret_password",
dbname="dbtable", host="hostname", port="portnumber")
dbSendQuery(redshiftcon,
"create table ss_playground.test_table (unique_id VARCHAR,
category VARCHAR,
name VARCHAR,
number_min float);")
<PostgreSQLResult:(70214,5,1)>
然而,当我试图检查表是否存在,如果场在那里,我得到以下信息:
dbExistsTable(redshiftcon, ss_playground.test_table)
Error in is(object, Cl) :
error in evaluating the argument 'name' in selecting a method for function
'dbExistsTable': Error: object 'ss_playground.test_table' not found
> dbExistsTable(redshiftcon, 'ss_playground.test_table')
[1] FALSE
我很困惑,因为我认为表已成功创建,但也无法在数据库本身中找到它。 当我试图再次发送,并创建它,我得到如下:
> dbSendQuery(redshiftcon,
"create table ss_playground.test_table (unique_id VARCHAR,
category VARCHAR,
name VARCHAR,
number_min float);")
Error in postgresqlExecStatement(conn, statement, ...) :
RS-DBI driver: (could not Retrieve the result : ERROR: Relation
'test_table' already exists)
有什么我失踪?
请帮忙! 谢谢
我不知道,但尝试添加'承诺;'你创建表后。有可能您的更改是特定于会话的,您可能希望先提交它们。 – rohitkulky