Registry / database / cartodb-psql

cartodb-psql

JSON →
library0.14.0jsnpmunverified

A simple PostgreSQL wrapper for Node.js, version 0.14.0, maintained by CartoDB for use in Windshaft and CartoDB-SQL-API. It provides opinionated connection logic for CartoDB's username/database conventions. The package has low maintenance activity and relies on node-postgres (pg). It is deprecated in favor of direct pg usage.

npm install cartodb-psql
INSTALL
IMPORT
SIG · CARTODB-PSQL
C
cartodb-psql
databasejavascriptv0.14.0
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
const CartoDBPSQL = require('cartodb-psql');
import CartoDBPSQL from 'cartodb-psql';
Package is CommonJS only; ESM imports not supported.
CartoDBPSQL
const CartoDBPSQL = require('cartodb-psql');
import * as CartoDBPSQL from 'cartodb-psql';
Named exports not available; only default export.
Pool
const { Pool } = require('pg');
const { Pool } = require('cartodb-psql');
cartodb-psql does not re-export Pool; use pg directly.

Shows how to instantiate CartoDBPSQL with connection parameters and execute a simple query.

const CartoDBPSQL = require('cartodb-psql'); const psql = new CartoDBPSQL({ user: process.env.PGUSER || 'cartodb_user', password: process.env.PGPASSWORD || '', host: process.env.PGHOST || 'localhost', port: process.env.PGPORT || 5432, database: process.env.PGDATABASE || 'cartodb_db' }); psql.query('SELECT 1 AS result', (err, result) => { if (err) throw err; console.log(result.rows[0].result); // 1 });
Debug
Known issues
deprecatedPackage is no longer actively maintained. Use 'pg' directly for new projects.
fix
Replace with `const { Pool } = require('pg');` and manage connections manually.
affects: >=0.0.0
breakingVersion 0.14.0 drops support for Node < 10.
fix
Upgrade Node.js to version 10 or higher.
affects: >=0.14.0
gotchaRequires npm >=6.4.1 and node >=10.15.1 per engines field.
fix
Use compatible Node/npm versions.
affects: >=0.14.0
gotchaConnection defaults assume CartoDB conventions; custom parameters may not work.
fix
Specify all connection parameters explicitly.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'cartodb-psql'
Package not installed or not published to npm registry.
fix
Run `npm install cartodb-psql` (if still available) or consider using 'pg' instead.
TypeError: CartoDBPSQL is not a constructor
Using ES module import syntax (import) with CommonJS module.
fix
Use `const CartoDBPSQL = require('cartodb-psql');`
getaddrinfo ENOTFOUND localhost
PostgreSQL not running or host not reachable.
fix
Ensure PostgreSQL service is started and host is correct.
Upgrade
Version history
0.14.0latest on npm
Audit
Dependencies
pgrequiredcore PostgreSQL client
debugrequireddebug logging support
Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
cartodb-psql — npm install cartodb-psql · libregistry