Skip to content

[R] write_adbc does not use create_append as adbc.ingest.mode #3475

@eitsupi

Description

@eitsupi

What happened?

The documentation suggests that the default behavior of write_adbc() is mode = "create_append", but in fact we can't specify mode = "create_append" and depending on the driver the default seems to be "create".

#' @param mode One of "create", "append", or "default" (error if the schema
#' is not compatible or append otherwise).

write_adbc.default <- function(tbl, db_or_con, target_table, ...,
mode = c("default", "create", "append"),
temporary = FALSE) {

adbc.ingest.mode = if (!identical(mode, "default")) paste0("adbc.ingest.mode.", mode),

con <- adbcdrivermanager::adbc_database_init(
  adbcsqlite::adbcsqlite(),
  uri = ":memory:"
) |>
  adbcdrivermanager::adbc_connection_init()

adbcdrivermanager::write_adbc(mtcars, con, "mtcars")
adbcdrivermanager::write_adbc(mtcars, con, "mtcars")
#> Error in adbc_statement_execute_query(stmt): INTERNAL: failed to execute: table "mtcars" already exists
#> query was: CREATE TABLE main . "mtcars" ("mpg" REAL, "cyl" REAL, "disp" REAL, "hp" REAL, "drat" REAL, "wt" REAL, "qsec" REAL, "vs" REAL, "am" REAL, "gear" REAL, "carb" REAL)

Created on 2025-09-24 with reprex v2.1.1

Stack Trace

No response

How can we reproduce the bug?

No response

Environment/Setup

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions