# Convert a CSV file to SQL (INSERT statements only)
tmp_csv <- tempfile(fileext = ".csv")
tmp_sql <- tempfile(fileext = ".sql")
write.csv(
data.frame(id = 1:2, value = c("a", "b"), date = c("2024-01-01", "2024-02-02")),
tmp_csv,
row.names = FALSE
)
convert_to_sql(tmp_csv, tmp_sql)
# Convert a CSV file to SQL with CREATE TABLE statement
convert_to_sql(tmp_csv, tmp_sql, create_table = TRUE)
Run the code above in your browser using DataLab