En cherchant à ajouter des données à une table avec dplyr, j'ai vu https://stackoverflow.com/a/26784801/1653571 mais la documentation indique db_insert_table()
est obsolète.Impossible d'ajouter des données à sqlite3 avec dplyr db_write_table()
?db_insert_into()
...
db_create_table() and db_insert_into() have been deprecated in favour of db_write_table().
...
J'ai essayé d'utiliser la place db_write_table()
non dépréciée, mais il échoue à la fois avec et sans l'option append=
:
require(dplyr)
my_db <- src_sqlite("my_db.sqlite3", create = TRUE) # create src
copy_to(my_db, iris, "my_table", temporary = FALSE) # create table
newdf = iris # create new data
db_write_table(con = my_db$con, table = "my_table", values = newdf) # insert into
# Error: Table `my_table` exists in database, and both overwrite and append are FALSE
db_write_table(con = my_db$con, table = "my_table", values = newdf,append=True) # insert into
# Error: Table `my_table` exists in database, and both overwrite and append are FALSE
Faut-il être en mesure d'ajouter des données avec db_write_table()
?
Voir aussi https://github.com/tidyverse/dplyr/issues/3120