if (FALSE) {
df <- read.csv(local_file)
# Create new table, fail if already exists
write_civis(df, "schema.my_table", "my_database")
# Create new table, append if already exists
write_civis(df, "schema.my_table", "my_database", if_exists="append")
# Create new table with additional options
write_civis(df, "schema.my_table", "my_database",
distkey="id",
sortkey1="added_date",
credential_id = 1,
header = FALSE)
# Create new table directly from a saved csv
write_civis("my/file/path.csv", "schema.my_table", "my_database")
# Create new table from a file_id
id <- write_civis_file("my/file/path.csv", name = "path.csv")
write_civis(id, "schema.my_table", "my_database")
}
Run the code above in your browser using DataLab