Registry / database / dbal
library1.0.0-alpha.5jsnpmunverified

Minimal wrapper on top of the pg (node-postgres) library, providing a simplified database abstraction layer for PostgreSQL in Node.js. Version 1.0.0-alpha.5 is the latest alpha release with TypeScript type definitions. The package is designed for simple query patterns with automatic connection handling and basic result mapping. It is lightly maintained and not recommended for production use due to alpha status and limited feature set compared to alternatives like knex or pg-promise.

npm install dbal
INSTALL
IMPORT
SIG · DBAL
D
dbal
databasejavascriptv1.0.0-alpha.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import dbal from 'dbal'
✗ const dbal = require('dbal')
ESM default import; CJS require works but lacks TypeScript autocomplete.
createPool
✓ import { createPool } from 'dbal'
✗ import createPool from 'dbal'
Named export, not default. Use curly braces.
DbalPool
✓ import type { DbalPool } from 'dbal'
✗ import { DbalPool } from 'dbal'
TypeScript type import (type-only) to avoid runtime import.

Shows how to create a connection pool, run a simple query, and cleanly shut down.

import dbal from 'dbal'; const pool = dbal.createPool({ user: process.env.PGUSER ?? 'postgres', host: process.env.PGHOST ?? 'localhost', database: process.env.PGDATABASE ?? 'test', password: process.env.PGPASSWORD ?? '', port: parseInt(process.env.PGPORT ?? '5432'), }); async function main() { const result = await pool.query('SELECT 1 AS number'); console.log(result.rows); await pool.end(); } main().catch(console.error);
Debug
Known issues
breakingThe API is unstable; alpha version may introduce breaking changes without notice.
fix
Pin to exact version and review changelog before upgrading.
affects: >=1.0.0-alpha
deprecatedThe package is in maintenance mode and not actively developed; consider using knex or pg-promise.
fix
Migrate to a more actively maintained library.
affects: *
gotchaMissing TypeScript types for some internal methods; rely on explicit type annotations.
fix
Use @types/pg alongside if type granularity is needed.
affects: >=1.0.0-alpha.1
Errors
Common errors & fixes
Cannot find module 'dbal'
Missing npm install or incorrect import path
fix
Run npm install dbal and check the package is installed in node_modules.
TypeError: dbal.createPool is not a function
Using default import incorrectly; createPool is a named export
fix
Use import { createPool } from 'dbal'.
Property 'rows' does not exist on type 'QueryResult'
TypeScript strict mode may require explicit typing; the result type might not include rows
fix
Assert type or use DbalTypes.QueryResult.
Upgrade
Version history
1.0.0-alpha.5latest on npm
Audit
Dependencies
pgrequiredCore PostgreSQL driver dependency
Agent activity
9 hits · last 30 days
node
8
Resources
packagedbal ↗
dbal — npm install dbal · libregistry