configuration.md
attributes
| source_path | references/sql/configuration.md |
|---|---|
| source_sha256 | ca737cee6436e3dc74bcbd56e07a3c42a65e40e2e056848eb311046041e60405 |
| source_url | https://github.com/cloudflare/skills/blob/47dfc2ce969bf62acf8bc231198ade4bb02712e0/skills/basin/references/sql/configuration.md |
| supporting_skill_id | 40178 |
| upstream_revision | 47dfc2ce969bf62acf8bc231198ade4bb02712e0 |
Basin SQL Configuration
Auth and setup. For the current permission matrix and wrangler flags, pull https://developers.cloudflare.com/basin-sql/reference/wrangler-commands/index.md and the Basin Catalog manage-catalogs doc.
Prerequisites
- R2 bucket with Basin Catalog enabled (catalog/configuration.md)
- R2 API token with Basin Catalog read, R2 Storage Admin Read & Write, and Basin SQL read permissions
- Wrangler CLI (for CLI queries)
R2 Storage Admin Read & Write is required even for read-only Basin SQL queries. Verify the current permission list in Query data.
Enable Catalog + Get Warehouse
npx wrangler basin catalog enable my-bucket
You query by warehouse name ({ACCOUNT_ID}_{BUCKET}), shown in the output alongside the Catalog URI.
Configure Auth
Wrangler CLI
export WRANGLER_BASIN_SQL_AUTH_TOKEN=<your-token>
# or a .env file in the project dir (auto-loaded): WRANGLER_BASIN_SQL_AUTH_TOKEN=<your-token>
Wrangler does not use the
wrangler loginOAuth session for Basin SQL — the env var is required.
REST API
curl -X POST \
"https://api.sql.cloudflarestorage.com/api/v1/accounts/$ACCOUNT_ID/basin-sql/query/$BUCKET" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"query": "SELECT * FROM default.my_table LIMIT 10"}'
Verify Setup
npx wrangler basin sql query "${ACCOUNT_ID}_my-bucket" "SHOW DATABASES"
npx wrangler basin sql query "${ACCOUNT_ID}_my-bucket" "SHOW TABLES IN default"
See Also
- api.md — SQL syntax · patterns.md — query examples · gotchas.md — troubleshooting
Children
No children yet.
Like how this is organised?
Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.