Waddler <> ClickHouse

To use Waddler with a ClickHouse database, you should use the @clickhouse/client driver.

Waddler natively supports @clickhouse/client with waddler/clickhouse package.

Step 1 - Install packages

npm
yarn
pnpm
bun
npm i waddler @clickhouse/client

Step 2 - Initialize the driver and make a query

clickhouse
clickhouse with config
import { waddler } from "waddler/clickhouse";

const sql = waddler(process.env.DATABASE_URL);

const result = await sql`select 1;`;

If you need to provide your existing driver:

import { waddler } from "waddler/clickhouse";
import { createClient } from '@clickhouse/client';
  
const client = createClient({
  url: '...',
  // url should have the following format: http[s]://<host>:<port>
  user: 'user',
  password: 'password',
  database: 'database',
});

const sql = waddler({ client });

const result = await sql`select 1;`;