Search Shortcut cmd + k | ctrl + k
Search cmd+k ctrl+k
0.10 (stable)
Cloudflare R2 Import

Prerequisites

For Cloudflare R2, the S3 Compatibility API allows you to use DuckDB’s S3 support to read and write from R2 buckets. This requires the httpfs extension, which can be installed use the INSTALL SQL command. This only needs to be run once.

Credentials and Configuration

You will need to generate an S3 auth token and create an R2 secret in DuckDB:

CREATE SECRET (
    TYPE R2,
    KEY_ID 'AKIAIOSFODNN7EXAMPLE',
    SECRET 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
    ACCOUNT_ID 'my_account_id'
);

Querying

After setting up the R2 credentials, you can query the R2 data using:

SELECT * FROM read_parquet('r2://⟨r2_bucket_name⟩/⟨file⟩');
About this page

Last modified: 2024-05-23