Skip to contents

Writes an Arrow Table or RecordBatch directly to DuckLake. This provides an alternative to db_write() when your data is already in Arrow format.

Usage

db_write_arrow(
  data,
  schema = "main",
  table,
  mode = c("overwrite", "append"),
  commit_author = NULL,
  commit_message = NULL
)

Arguments

data

An Arrow Table, RecordBatch, or data.frame

schema

Schema name (default "main")

table

Table name

mode

"overwrite" or "append"

commit_author

Optional author for DuckLake commit metadata

commit_message

Optional message for DuckLake commit metadata

Value

Invisibly returns the qualified table name

See also

db_write() for writing data.frames with more options, db_read_arrow() for reading as Arrow

Examples

if (FALSE) { # \dontrun{
db_connect(...)

# Write Arrow Table
arrow_tbl <- arrow::arrow_table(id = 1:3, value = c(10, 20, 30))
db_write_arrow(arrow_tbl, table = "metrics")

# Write from parquet file
arrow_tbl <- arrow::read_parquet("data.parquet")
db_write_arrow(arrow_tbl, table = "imports", mode = "append")
} # }