db-meta is a JavaScript library for extracting relational database metadata (tables, columns, data types, nullability, primary keys, default values, version) from PostgreSQL, MySQL, and SQLite3. Version 0.5.1 is the current stable release, with irregular updates. It abstracts over database-specific drivers (pg, mysql, sqlite3) using a unified callback-based API. Unlike ORM tools, it focuses purely on schema introspection without query building or object mapping. Requires Node.js >=0.6 and manual installation of the appropriate database driver.
npm install db-metaVerified import paths — ran on the pinned version, not inferred.
Shows how to connect to PostgreSQL, retrieve database version, list all user tables, and inspect columns for a specific table using callbacks.
npm install pg # or mysql or sqlite3
Always check err: getTables(function(err, tables) { if (err) throw err; ... })Wrap in a Promise manually or use a library like util.promisify.
Use 'pg' instead of 'postgres'.
Check driver documentation for connection reuse support.
npm install pg
Ensure first argument is a valid driver string, second is options object, and third is a callback that accepts (err, meta).
Use meta.getColumns('tableName', callback), not table.getColumns().Verify database is running and check host, port, database name, user, password in options.