Skip to main content

Cloudflare R2 Import

For Cloudflare R2, the S3 Compatibility API allows you to use SereneDB's built-in S3 support to read and write from R2 buckets.

Credentials and Configuration

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

Query
CREATE SECRET (    TYPE r2,    KEY_ID '⟨AKIAIOSFODNN7EXAMPLE⟩',    SECRET '⟨wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY⟩',    ACCOUNT_ID '⟨your-33-character-hexadecimal-account-ID⟩');

Querying

After setting up the R2 credentials, you can query the R2 data using SereneDB's built-in methods, such as read_csv or read_parquet:

Query
SELECT * FROM read_parquet('r2://⟨r2-bucket-name⟩/⟨file⟩');
Result
 id | name  | value----+-------+-------  1 | alpha |    10  2 | beta  |    20