A console/REPL for Cloudflare's D1 Database product.
Supports all the features expected of a modern database client, including:
- multiline queries
- table-formatted query outputs
- command history
- the ability to save your Cloudflare credentials for later use (opt-in)
- First, run
d1-console login --account-id <ID> --api-token <TOKEN>
to save your credentials for later use. To generate an API token, go to the API Tokens page on the Cloudflare dashboard. Your account ID can be found on any zone (domain) of your Cloudflare account. - You can now create a database using
d1-console databases create <NAME>
. - To query your new D1 database, you can use the
d1-console -d <NAME>
command.
- Aside from subcommands (such as
d1-console databases create <name
) you can also create, list, delete, and switch databases from within D1 Console. To view available commands, use theHELP
command within D1 Console.
- If you wish to use D1 Console in CI/CD pipelines, the flag
--execute
can be used to immediately execute a command passed in (e.g.--execute "SELECT * FROM USERS"
). In addition, D1 Console will now preferCLOUDFLARE_ACCOUNT_ID
andCLOUDFLARE_API_TOKEN
environment variables over the saved authentication (if any).
For more information, to get help, or just to chat about D1 and D1 Console, join us on the Cloudflare Developers Discord!