Learn R Programming

contoso (version 2.0.0)

create_contoso_duckdb: Creates DuckDB database with Contoso datasets

Description

Creates a DuckDB connection with Contoso datasets loaded from cloud storage. The datasets are stored as Parquet files on Backblaze B2 and streamed directly into DuckDB.

Usage

create_contoso_duckdb(size = "small")

Value

A list containing:

  • sales, product, customer, store, fx, calendar, orders, orderrows: lazy tbl objects

  • con: the DuckDB connection (use DBI::dbDisconnect(db$con, shutdown = TRUE) when done)

Arguments

size

Dataset size: "small", "medium", "large", or "mega"

Details

The create_contoso_duckdb() function creates views for the following Contoso datasets:

  • sales: Contains sales transaction data.

  • product: Contains details about products, including attributes like product name, manufacturer, and category.

  • customer: Contains customer demographic and geographic information.

  • store: Contains information about store locations and attributes.

  • fx: Contains foreign exchange rate data for currency conversion.

  • calendar: Contains various date-related information, including day, week, month, and year.

  • orders: Contains order header information.

  • orderrows: Contains order line items.

Available sizes (approximate sales rows):

  • small: ~8,000 rows

  • medium: ~2.3 million rows

  • large: ~47 million rows

  • mega: ~237 million rows

Examples

Run this code
if (FALSE) {
  db <- create_contoso_duckdb(size = "small")
  db$sales |> head()
  DBI::dbDisconnect(db$con, shutdown = TRUE)
}

Run the code above in your browser using DataLab