redash icon indicating copy to clipboard operation
redash copied to clipboard

Cloudflare D1 query runner support

Open fjuliofontes opened this issue 2 months ago • 4 comments

What type of PR is this?

  • [x] Feature
  • [x] New Query Runner (Data Source)

Description

This PR adds support for Cloudflare D1 as a new query runner for Redash (v25.8.0). The integration allows users to connect to a D1 database and run SQL queries directly from Redash.

Compatibility: Tested against the current Cloudflare D1 (SQLite-based) implementation. Expected to work with all active D1 versions.

Required Parameters:

Cloudflare D1 API URL

Example:

https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/d1/database/DATABASE_ID/query

Cloudflare API Token

ACCOUNT_API_TOKEN

How is this tested?

  • [x] Manually

Manual testing details:

Verified connection to a Cloudflare D1 instance. Ran multiple queries (SELECT, CREATE, INSERT) and confirmed results are returned properly in Redash. Checked error handling for invalid queries and connection issues.

Related Tickets & Documents

N/A

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

register query_example

fjuliofontes avatar Oct 01 '25 07:10 fjuliofontes

Hi guys, I would a appreciate if someone that has the development environment already setup could run the make format for this PR. I'm currently using docker images for the tests so I don't have all the required packages installed on my mac.

(redashvenv1) $ make format
pre-commit run --all-files
isort....................................................................Passed
black....................................................................Passed
flake8...................................................................Passed

Thanks

fjuliofontes avatar Oct 01 '25 07:10 fjuliofontes

@fjuliofontes

Thank you for the PR ! I think just running "make format" inside container should be enough, assuming the code is volume mounted.

yoshiokatsuneo avatar Oct 01 '25 09:10 yoshiokatsuneo

@fjuliofontes

Thank you for the PR ! I think just running "make format" inside container should be enough, assuming the code is volume mounted.

Hi @yoshiokatsuneo,

Yes, I'm running on a docker environment. I've attempted to run "make format" inside the container but it does not work. It asks for the git repository.

fjuliofontes avatar Oct 04 '25 20:10 fjuliofontes

@fjuliofontes

How about running command like below on your Redash directory ?

$ docker compose run --rm server /bin/bash
...
redash@c1e0f575e89c:/app$ make format
pre-commit run --all-files
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/charliermarsh/ruff-pre-commit.
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/charliermarsh/ruff-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
black....................................................................Passed
ruff.....................................................................Passed

yoshiokatsuneo avatar Oct 05 '25 03:10 yoshiokatsuneo