{"id":42606,"library":"dbal","title":"dbal","description":"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.","status":"maintenance","version":"1.0.0-alpha.5","language":"javascript","source_language":"en","source_url":"git://github.com/litek/node-dbal","tags":["javascript","typescript"],"install":[{"cmd":"npm install dbal","lang":"bash","label":"npm"},{"cmd":"yarn add dbal","lang":"bash","label":"yarn"},{"cmd":"pnpm add dbal","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core PostgreSQL driver dependency","package":"pg","optional":false}],"imports":[{"note":"ESM default import; CJS require works but lacks TypeScript autocomplete.","wrong":"const dbal = require('dbal')","symbol":"default","correct":"import dbal from 'dbal'"},{"note":"Named export, not default. Use curly braces.","wrong":"import createPool from 'dbal'","symbol":"createPool","correct":"import { createPool } from 'dbal'"},{"note":"TypeScript type import (type-only) to avoid runtime import.","wrong":"import { DbalPool } from 'dbal'","symbol":"DbalPool","correct":"import type { DbalPool } from 'dbal'"}],"quickstart":{"code":"import dbal from 'dbal';\n\nconst pool = dbal.createPool({\n  user: process.env.PGUSER ?? 'postgres',\n  host: process.env.PGHOST ?? 'localhost',\n  database: process.env.PGDATABASE ?? 'test',\n  password: process.env.PGPASSWORD ?? '',\n  port: parseInt(process.env.PGPORT ?? '5432'),\n});\n\nasync function main() {\n  const result = await pool.query('SELECT 1 AS number');\n  console.log(result.rows);\n  await pool.end();\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Shows how to create a connection pool, run a simple query, and cleanly shut down."},"warnings":[{"fix":"Pin to exact version and review changelog before upgrading.","message":"The API is unstable; alpha version may introduce breaking changes without notice.","severity":"breaking","affected_versions":">=1.0.0-alpha"},{"fix":"Migrate to a more actively maintained library.","message":"The package is in maintenance mode and not actively developed; consider using knex or pg-promise.","severity":"deprecated","affected_versions":"*"},{"fix":"Use @types/pg alongside if type granularity is needed.","message":"Missing TypeScript types for some internal methods; rely on explicit type annotations.","severity":"gotcha","affected_versions":">=1.0.0-alpha.1"}],"env_vars":null,"search_vec":"'1.0.0':24 'abstract':17 'alpha':29,63 'alpha.5':25 'altern':71 'automat':44 'basic':48 'compar':69 'connect':45 'databas':16 'dbal':1 'definit':34 'design':38 'due':61 'featur':67 'handl':46 'javascript':78 'knex':73 'latest':28 'layer':18 'librari':12 'light':53 'like':72 'limit':66 'maintain':54 'map':50 'minim':2 'node':10 'node-postgr':9 'node.js':22 'packag':36 'pattern':42 'pg':8,76 'pg-promis':75 'postgr':11 'postgresql':20 'product':59 'promis':77 'provid':13 'queri':41 'recommend':57 'releas':30 'result':49 'set':68 'simpl':40 'simplifi':15 'status':64 'top':5 'type':33 'typescript':32,79 'use':60 'version':23 'wrapper':3","created_at":"2026-06-05T16:55:47.127504+00:00","updated_at":"2026-06-05T16:55:47.127504+00:00","problems":[{"fix":"Run npm install dbal and check the package is installed in node_modules.","cause":"Missing npm install or incorrect import path","error":"Cannot find module 'dbal'"},{"fix":"Use import { createPool } from 'dbal'.","cause":"Using default import incorrectly; createPool is a named export","error":"TypeError: dbal.createPool is not a function"},{"fix":"Assert type or use DbalTypes.QueryResult.","cause":"TypeScript strict mode may require explicit typing; the result type might not include rows","error":"Property 'rows' does not exist on type 'QueryResult'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/litek/node-dbal","github":"git://github.com/litek/node-dbal","docs":null,"changelog":null,"pypi":null,"npm":"dbal","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}