I am new to connecting to Redshift via R, I have read other questions but am still getting an error when I attempt to create a table. I have successfully set up a connection and I thought set up the table successfully:
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)>
However, when I attempt to check if the table exists and if the fields are there, I get the following message:
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
I am confused because I thought the table was created successfully, but also cannot find it in the database itself. When I attempt to send it and create it again, I get the following:
> 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)
Is there something I am missing?
Please help! Thank you