Sites: add an owner-authorized SQL import path for managed D1 bindings
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- PR merge metrics
- PR metrics pending
Description
Summary
Sites can provision and bind a managed D1 database to an existing private site, but the current Sites connector exposes only bounded read operations for that database. There is no supported connector operation to execute approved SQL or import an SQL file into the managed D1 binding.
Reproduction
- Use an existing private Sites project with a D1 binding declared in
.openai/hosting.json. - Confirm the site and D1 binding can be read through the Sites connector.
- Attempt to seed a production-ready lexical index from a generated SQL artifact (about 45 MB).
- The available connector actions permit database overview and bounded row reads, but provide no remote SQL execution or SQL-file import action.
Expected behavior
Provide a safe, explicit, owner-authorized path to import an SQL file into a Sites-managed D1 binding, with progress/status reporting and a read-only verification path afterward.
Actual behavior
The only practical alternatives appear to be migrating the application to a separately self-managed Cloudflare account/database or modifying application source to perform a one-off seed. Both are disproportionate for an otherwise managed Sites deployment and make an exact release deployment harder to preserve.
Why this matters
Managed D1 is useful for applications with prebuilt indexes, reference data, or other substantial static datasets. A bounded import capability would allow these apps to remain on Sites without exposing credentials or adding a temporary runtime backdoor.
Requested capability
A connector/API action such as import_d1_sql(project_id, binding_name, file), limited to authorized project owners, plus deployment-safe read-only count/query verification.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating the Sites connector's existing D1 binding read operations and authorization paths; done means an owner-authorized SQL import with progress/status reporting and a read-only count or query verification path, including coverage for the roughly 45 MB artifact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- api, cloud, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100