Skip to content
Snippets Groups Projects
Commit 9ba59a90 authored by ronan.vignard's avatar ronan.vignard
Browse files

Ajout du paramètre host et modification de l'exemple pour insert_into_table()

parent c30f15a1
Branches
No related tags found
4 merge requests!67Passage en version 0.1.6,!66Intégration de la fonction download_files_from_list(),!65Correction d'un bug + création des tests pour fix_encoding_variable(),!64Création des tests pour insert_into_table()
......@@ -59,23 +59,28 @@ archive_table(host = "localhost",
```{r examples-insert_into_table, eval=FALSE}
#' \dontrun{
# Création d'un dataframe à partir d'un fichier XLSX
data_ars_2022 <- collectr::import_xlsx(
filepath = "C:\\TEMP\\Nitrates_2022.xlsx",
sheet = 1,
row = 1)
# Ajout d'un champs de géométrie
data_ars_2022 <- data_ars_2022 |>
dplyr::select(-coord_x,-coord_y) |>
dplyr::mutate(eligible_ades = rep(NA, dplyr::n()))
# Utilisation de la fonction insert_into_table()
insert_into_table(database = "si_eau",
schema = "nitrates",
table = "nitrate_data_analyse_ars_test",
dataframe = data_ars_2022,
role = "admin")
# Créer une dataframe source
source <- data.frame(
id = 6:10,
name = c("Alice", "Bob", "Charlie", "David", "Eve"),
birthdate = c("1990-01-15", "1985-06-22", "1992-09-10", "1988-03-05", "1995-12-30"),
value = rnorm(5)
)
# Créer une table target dans le schéma public de la base collectr
create_dummy(host = "localhost",
database = "collectr",
schema = "public",
table = "target",
pk = "id",
id_range = "1:5",
role = "runner")
# Utilisation de la fonction insert_into_table()
insert_into_table(host = "localhost",
database = "collectr",
schema = "public",
table = "target",
dataframe = source,
role = "runner")
#' }
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment