Waddler <> Nile
This guide assumes familiarity with:
- Database connection basics with Drizzle
- Nile Database - website
- Waddler PostgreSQL drivers - docs
According to the official website, Nile is PostgreSQL re-engineered for multi-tenant apps.
You can use Nile with any of Drizzle’s Postgres drivers, we’ll be showing the use of node-postgres
below.
Step 1 - Install packages
npm
yarn
pnpm
bun
npm i waddler pg
npm i -D drizzle-kit
Step 2 - Initialize the driver and make a query
// Make sure to install the 'pg' package
import { waddler } from 'waddler/node-postgres'
const sql = waddler(process.env.NILEDB_URL);
const result = await sql`select 1;`;
If you need to provide your existing driver:
// Make sure to install the 'pg' package
import { waddler } from "waddler/node-postgres";
import { Pool } from "pg";
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
});
const sql = waddler({ client: pool });
const result = await sql`select 1;`;