I am trying to connect R to Redshift using dplyr and RPostgreSQL based on the method from https://blogs.aws.amazon.com/bigdata/post/Tx1G8828SPGX3PK/Connecting-R-with-Amazon-Redshift
Now I know my database, host port, user and password. So, here is my code:
> myRedshift <- src_postgres('aaa',
host = 'aaa-aaa-aaa.com',
port = 8000,
user = "xy",
password = "xy")
After running this line, I have a list myRedshift. It looks like OK. But, when I run:
a <- tbl(myRedshift, "base_posdata")
The problem is: the database aaa includes a couple of folders like a1, a2, a3. The table base_posdata is under a1. So it is supposed to be like:
a <- tbl(myRedshift, "a1//base_posdata")
Of course the format is not correct. So when I use the above code (a <- tbl(myRedshift, "base_posdata") ), I have the error message:
Error in postgresqlExecStatement(conn, statement, ...) :
RS-DBI driver: (could not Retrieve the result : ERROR: relation "base_posdata" does not exist)
I guess this is because I did not provide the right path. Anyone can tell me how to do this? Thanks a lot.