az_copy_to: Copy data to Azure Data Lake Storage Gen2

View source: R/lake.R

az_copy_toR Documentation

Copy data to Azure Data Lake Storage Gen2

Description

Writes a lazy table, data frame, or SQL query to an ⁠abfs://⁠ or ⁠abfss://⁠ URL using DuckDB's ⁠COPY ... TO⁠ command.

Usage

az_copy_to(
  conn,
  x,
  url,
  format = c("parquet", "csv", "json"),
  partition_by = NULL,
  overwrite = FALSE
)

Arguments

conn

A DuckDB connection.

x

A lazy dbplyr table, data frame, SQL string, or DBI::SQL object.

url

Character scalar. Azure Blob URL to write to.

format

Output format. One of "parquet", "csv", or "json".

partition_by

Optional character vector of columns to partition by.

overwrite

Logical. When TRUE, passes DuckDB's OVERWRITE_OR_IGNORE copy option.

Value

Invisibly returns url.

Examples

## Not run: 
# Requires a live Azure account, credentials, and network access.
conn <- az_conn()
az_copy_to(
  conn,
  "SELECT * FROM events WHERE event_date >= DATE '2026-01-01'",
  "abfss://container@account/exports/events",
  format = "parquet"
)

## End(Not run)

quak documentation built on June 9, 2026, 5:09 p.m.