Skip to content

Read a Parquet blob into an R data frame

Reads a Parquet file via a storage handler created by [init_storage_handler()(init_storage_handler/) and converts the resulting Python Polars DataFrame to an R data frame. Optionally returns the Parquet metadata as well. Selected columns specified via col_classes can be cast in Polars before conversion to R.

read_parquet_blob_as_df(
handler,
blob_name,
include_metadata = FALSE,
col_classes = NULL,
...
)
Argument Description
handler A Python object of class StorageHandler.
blob_name The path/name of the blob/file.
include_metadata Logical; if TRUE, return both data and metadata.
col_classes A named character vector of R column classes.
... Additional arguments passed to handler$read_parquet_blob().

A data frame, or a list with components data and metadata if include_metadata = TRUE.

handler <- init_storage_handler()
result <- read_parquet_blob_as_df(
handler = handler,
blob_name = "sample/data.parquet",
include_metadata = TRUE,
col_classes = c(
id = "character",
customer_id = "character",
amount = "numeric",
active = "logical",
created_at = "POSIXct"
)
)