The table's schema is taken from data, so an existing data frame is enough
to define one. Iceberg field ids are assigned automatically, since a data
frame has no concept of them.
Arguments
- catalog
An
icebergr_catalogfromicebergr_catalog().- table
A table identifier,
"namespace.table". The namespace must already exist; seeicebergr_create_namespace().- data
A data frame whose columns define the schema. No rows are written; only the column names and types are used. An Arrow schema is also accepted.
- location
Where to store the table.
NULLlets the catalog decide, which is almost always what you want. A local path is expanded and made absolute first, since it is recorded in the table's metadata as written.
Details
The table is created unpartitioned. Partitioned table creation, like partition
evolution, is out of scope for this version; see icebergr_spec_support().
Examples
warehouse <- tempfile("warehouse")
dir.create(warehouse)
catalog <- icebergr_catalog("memory", warehouse = warehouse)
icebergr_create_namespace(catalog, "db")
tbl <- icebergr_create_table(
catalog, "db.events",
data.frame(id = integer(), amount = double(), label = character())
)
icebergr_schema(tbl)
#> # A tibble: 3 × 5
#> field_id name type required doc
#> <int> <chr> <chr> <lgl> <chr>
#> 1 1 id int FALSE NA
#> 2 2 amount double FALSE NA
#> 3 3 label string FALSE NA