db <- create_contoso_duckdb(size = "small")
db$sales |> head()
DBI::dbDisconnect(db$con, shutdown = TRUE)Creates DuckDB database with Contoso datasets
Source: R/database.R
Creates a DuckDB connection with Contoso datasets loaded from cloud storage. The datasets are stored as Parquet files on Cloudflare R2 and streamed directly into DuckDB.
Usage
create_contoso_duckdb(size = "small")Arguments
Value
A list containing:
-
sales,product,customer,store,fx,calendar,orders,orderrows: lazytblobjects -
con: the DuckDB connection (useDBI::dbDisconnect(db$con, shutdown = TRUE)when done)
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 (sales rows):
-
small: 7,794 -
medium: 2,349,091 -
large: 23,719,935 -
mega: 237,245,485
Schemas
Column names, order and types are identical across all four sizes: date columns are DATE, keys and counts are BIGINT, and measures are DOUBLE. Only the row counts differ.
size = “small” serves the same data as the bundled sales, customer and friends. The larger sizes come from separate generator runs, so they cover a different date range and a much larger customer catalogue – including customers who never place an order, which the bundled data excludes.