我使用R從我的工作站遠程連接到Redshift。使用R將Redshift中的CSV導出爲CSV PostGreSQL
install.packages("RPostgreSQL")
library (RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con1 <- dbConnect(drv, host="url", port="xxxx",
dbname="db_name", user="id", password="password")
dbGetInfo(con1)
然後我創建一個表:
dbSendQuery(con1, "create table schema.table_name as select * from schema.table_name;")
現在我想將這個表導出到.csv文件我的工作站上,如何做到這一點?同樣,我沒有在我的工作站上安裝PostGres數據庫,只使用R來訪問它。
此外,此表是大型,4列,1400萬行。
謝謝!