Snowflake
Below is an example of using Snowflake ↗ to connect and query data from R2 Data Catalog (read-only).
- Sign up for a Cloudflare account ↗.
- Create an R2 bucket and enable the data catalog.
- Create an R2 API token with both R2 and data catalog permissions.
- A Snowflake ↗ account with the necessary privileges to create external volumes and catalog integrations.
In your Snowflake SQL worksheet ↗ or notebook ↗, run the following commands:
-- Create a database (if you don't already have one) to organize your external dataCREATE DATABASE IF NOT EXISTS r2_example_db;
-- Create an external volume pointing to your R2 bucketCREATE OR REPLACE EXTERNAL VOLUME ext_vol_r2    STORAGE_LOCATIONS = (        (            NAME = 'my_r2_storage_location'            STORAGE_PROVIDER = 'S3COMPAT'            STORAGE_BASE_URL = 's3compat://<bucket-name>'            CREDENTIALS = (                AWS_KEY_ID = '<access_key>'                AWS_SECRET_KEY = '<secret_access_key>'            )            STORAGE_ENDPOINT = '<account_id>.r2.cloudflarestorage.com'        )    )    ALLOW_WRITES = FALSE;
-- Create a catalog integration for R2 Data Catalog (read-only)CREATE OR REPLACE CATALOG INTEGRATION r2_data_catalog    CATALOG_SOURCE = ICEBERG_REST    TABLE_FORMAT = ICEBERG    CATALOG_NAMESPACE = 'default'    REST_CONFIG = (        CATALOG_URI = '<catalog_uri>'        CATALOG_NAME = '<warehouse_name>'    )    REST_AUTHENTICATION = (        TYPE = BEARER        BEARER_TOKEN = '<token>'    )    ENABLED = TRUE;
-- Create an Apache Iceberg table in your selected Snowflake databaseCREATE ICEBERG TABLE my_iceberg_table    CATALOG = 'r2_data_catalog'    EXTERNAL_VOLUME = 'ext_vol_r2'    CATALOG_TABLE_NAME = 'my_table';  -- Name of existing table in your R2 data catalog
-- Query your Iceberg tableSELECT * FROM my_iceberg_table;Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark