S4 class that represents DeltaTable
Examples
if (FALSE) {
set.seed(323)
# Write to file system and read back
tbl_path <- tempfile()
df <- data.frame(
id = 1:12,
key = rep(c("a", "b", "c"), each = 4),
value = rnorm(12)
) %>%
createDataFrame()
df %>%
dlt_write(tbl_path)
dlt_for_path(tbl_path) %>%
dlt_to_df() %>%
printSchema()
# Write as table and read back
tbl_name <- paste0("delta_table_", paste0(base::sample(letters, 10, TRUE), collapse = ""))
df %>%
saveAsTable(tableName = tbl_name, source = "delta")
tbl <- dlt_for_name(tbl_name)
tbl %>%
dlt_show()
# Update tbl
tbl %>%
dlt_delete("id in (1, 3)") %>%
dlt_update(c(value = "-value"), "key = 'c'")
# Check delta log
tbl %>%
dlt_history() %>%
select("version", "timestamp", "operation", "operationParameters") %>%
showDF(truncate = FALSE)
# Get detailed information about the table
tbl %>%
dlt_detail() %>%
showDF()
}