RPostgreSQL - import data into a table

I want to export a complete dataframe to a table that is already created in the database (postgresql) and contains similar data.

I found several questions explaining the dbwrite table (.... overwrite = TRUE), I do not want to overwrite the data that is already in my table. I just want to update a table with a data table from console r.

can someone let me know how i can do this.

something like that

dbInsertTable(con, df, tablename = "MyTable")
+4
source share
1 answer

You will need dbWriteTable

Assuming you are not using row names in your data frame that you would do

dbWriteTable(con, "MyTable", df, row.names=FALSE, append=TRUE)

, df , TRUE. , , c('myschema', 'MyTable') "myschema.MyTable". , , . , .

, , , postgres , . , - dbWriteTable(con, '"MyTable"', df, row.names=FALSE, append=TRUE)

+5

Source: https://habr.com/ru/post/1615281/


All Articles