template_dataset: Access a Dataset for a Template

View source: R/template.R

template_datasetR Documentation

Access a Dataset for a Template

Description

This function provides access to a dataset associated with a specific template. It retrieves the dataset stored in the database folder for the given template and layer, using the schema defined in the template configuration.

Usage

template_dataset(template, layer = NULL)

Arguments

template

The template identifier or template object. This specifies the dataset to retrieve.

layer

The layer of the dataset to access (e.g., "input" or "staging"). If NULL, the layer ⁠"input⁠ is used.

Details

The template_dataset() function is a generic function that dispatches to specific methods based on the type of the template argument. It retrieves the dataset by resolving the template using template_retrieve() if the input is a template identifier.

Value

An Arrow dataset object representing the data for the specified template and layer.

Examples

## Not run: 
# Access the dataset for the "b3-reference-rates" template
ds <- template_dataset("b3-reference-rates")

# Access the dataset for the "b3-reference-rates" template in the staging layer
ds <- template_dataset("b3-reference-rates", layer = "staging")

# Query the dataset
ds |>
  dplyr::filter(refdate > as.Date("2023-01-01")) |>
  dplyr::collect()

## End(Not run)


rb3 documentation built on Aug. 8, 2025, 6:20 p.m.