Ingests a DuckDB table, view, or dbplyr query into SedonaDB.
This operation uses zero-copy Arrow streaming to transfer data efficiently
between DuckDB and SedonaDB.
Arguments
- data
A
tbl_duckdb_connection(fromdbplyr), or a character string representing a table/view name in DuckDB.- conn
A
duckdb_connectionobject. Required ifdatais a character string.- name
Character string. Optional name for the registered view in SedonaDB. If
NULL, a temporary name is generated.- materialize
Logical. If
TRUE(default), force materialization of the data in SedonaDB to complete the transfer. IfFALSE, returns a lazy pointer (safer for huge datasets, but source connection must remain open).- verbosity
Character or NULL. Controls message output for this function call.
"quiet": Suppress all informational messages."info": Show standard progress and status messages."debug": Show additional diagnostic messages for troubleshooting.
If NULL (the default), uses the global
sx.verbosityoption. Seesx_options()for persistent configuration.
Examples
if (FALSE) { # \dontrun{
library(sx)
library(dplyr)
library(dbplyr)
library(duckdb)
con <- dbConnect(duckdb())
dbExecute(con, "INSTALL spatial; LOAD spatial;")
# Create a table in DuckDB
dbExecute(con, "CREATE TABLE points (id INTEGER, geom GEOMETRY)")
dbExecute(con, "INSERT INTO points VALUES (1, ST_Point(0,0))")
# Option 1: Ingest from dbplyr object (connection auto-detected)
tbl_points <- tbl(con, "points")
sdf <- sx_duckdb_to_sedona(tbl_points)
# Option 2: Ingest from table name (requires connection)
sdf_2 <- sx_duckdb_to_sedona("points", conn = con)
# Option 3: Ingest and register as named view
sx_duckdb_to_sedona("points", conn = con, name = "sedona_points_view")
dbDisconnect(con)
} # }
