Cloudflare D1 Connections
TablePro supports Cloudflare D1, a serverless SQLite-compatible database. TablePro connects via the Cloudflare REST API using your API token - no direct database connections or SSH tunnels needed.
Install Plugin
The Cloudflare D1 driver is available as a downloadable plugin. When you select Cloudflare D1 in the connection form, TablePro will prompt you to install it automatically. You can also install it manually:
- Open Settings > Plugins > Browse
- Find Cloudflare D1 Driver and click Install
- The plugin downloads and loads immediately - no restart needed
Quick Setup
Open Connection Form
Click New Connection from the Welcome screen or File > New Connection
Select Cloudflare D1
Choose Cloudflare D1 from the database type selector
Enter Connection Details
Fill in your database name (or UUID), Cloudflare Account ID, and API token
Test and Connect
Click Test Connection, then Create
Connection Settings
Required Fields
| Field | Description |
|---|
| Name | Connection identifier |
| Database | D1 database name or UUID |
| Account ID | Your Cloudflare account ID |
| API Token | Cloudflare API token with D1 permissions |
You can use either the database name (e.g., my-app-db) or the database UUID. If you use a name, TablePro resolves it to the UUID automatically via the Cloudflare API.
Getting Your Credentials
Account ID
Find your Account ID on the Cloudflare dashboard right sidebar, or run:
API Token
- Go to Cloudflare API Tokens
- Click Create Token
- Select Custom token template
- Add permission: Account > D1 > Edit
- Save and copy the token
Store your API token securely. TablePro saves it in the macOS Keychain, but the token grants access to all D1 databases in your account.
Create a D1 Database
If you don’t have a D1 database yet:
# Install Wrangler CLI
npm install -g wrangler
# Login to Cloudflare
wrangler login
# Create a database
wrangler d1 create my-app-db
# Seed with test data
wrangler d1 execute my-app-db --remote \
--command "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)"
wrangler d1 execute my-app-db --remote \
--command "INSERT INTO users VALUES (1, 'Alice', '[email protected]')"
You can also create databases directly from TablePro using the Create Database button in the database switcher.
Example Configuration
Name: My D1 Database
Database: my-app-db
Account ID: abc123def456
API Token: (your Cloudflare API token)
Features
Database Browsing
After connecting, use the database switcher in the toolbar to list and switch between all D1 databases in your Cloudflare account. The sidebar shows tables and views in the selected database.
Table Browsing
For each table, TablePro shows:
- Structure: Columns with SQLite data types, nullability, default values, and primary key info
- Indexes: B-tree indexes with column details
- Foreign Keys: Foreign key constraints with referenced tables
- DDL: The full CREATE TABLE statement
Query Editor
Write and execute SQL queries using SQLite syntax:
-- Query data
SELECT name, email FROM users WHERE id > 10 ORDER BY name;
-- Create tables
CREATE TABLE posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES users(id),
title TEXT NOT NULL,
content TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Aggregations
SELECT user_id, COUNT(*) as post_count
FROM posts
GROUP BY user_id
HAVING post_count > 5;
EXPLAIN Query Plan
Analyze query execution plans using the Explain button in the query editor. TablePro uses EXPLAIN QUERY PLAN to show how SQLite processes your queries.
Data Editing
Edit cell values, insert rows, and delete rows directly in the data grid. Changes are submitted as standard INSERT, UPDATE, and DELETE statements via the D1 API.
Database Management
- List Databases: View all D1 databases in your Cloudflare account
- Switch Database: Switch between databases without reconnecting
- Create Database: Create new D1 databases directly from TablePro
Export
Export query results or table data to CSV, JSON, SQL, and other formats.
SQL Dialect
D1 uses SQLite’s SQL syntax. Key points:
- Identifier quoting: Double quotes (
"column_name")
- String literals: Single quotes (
'value')
- Auto-increment:
INTEGER PRIMARY KEY AUTOINCREMENT
- Type affinity: SQLite’s flexible type system applies
- PRAGMA support: Most SQLite PRAGMAs work (
PRAGMA table_info, PRAGMA foreign_key_list, etc.)
Troubleshooting
Authentication Failed
Symptoms: “Authentication failed. Check your API token and Account ID.”
Solutions:
- Verify your API token has D1 Edit permissions
- Check that the Account ID matches your Cloudflare account
- Ensure the token has not expired or been revoked
- Try creating a new API token
Database Not Found
Symptoms: “Database ‘name’ not found in account”
Solutions:
- Verify the database name or UUID is correct
- Check that the database exists:
wrangler d1 list
- Ensure your API token has access to the account containing the database
Rate Limited
Symptoms: “Rate limited by Cloudflare”
Solutions:
- Wait for the retry period indicated in the error message
- Reduce query frequency
- Use pagination for large result sets instead of fetching all rows
Connection Timeout
Symptoms: Queries take too long or time out
Solutions:
- Check your internet connection
- Verify the Cloudflare API is operational at Cloudflare Status
- Simplify complex queries that may exceed D1’s execution limits
Known Limitations
- No persistent connections: each query is an independent HTTP request with no session state
- No multi-statement transactions: each SQL statement auto-commits independently
- No schema editing UI: use SQL in the query editor for ALTER TABLE
- 10 GB database limit per D1 database. Shard for larger datasets
- API rate limits apply. TablePro shows rate limit errors with retry timing
- No bulk import through the plugin: use
wrangler d1 execute with SQL files
- No custom SSL/SSH: D1 is HTTPS-only via Cloudflare API