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.
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CommonJS only; no ESM or default export available.
const dbmeta = require('db-meta')
db-meta exports a single function, not a class or object.
dbmeta('pg', { database: 'test' }, function(err, meta) {
meta.getVersion(function(err, version) { ... });
});
Table objects are plain objects with methods like getName(), not classes.
meta.getTables(function(err, tables) {
tables.forEach(function(table) { console.log(table.getName()); });
});
Shows how to connect to PostgreSQL, retrieve database version, list all user tables, and inspect columns for a specific table using callbacks.
const dbmeta = require('db-meta');
dbmeta('pg', { database: 'test' }, function(err, meta) {
if (err) return console.error(err);
meta.getVersion(function(err, version) {
if (err) return console.error(err);
console.log('PostgreSQL version:', version);
});
meta.getTables(function(err, tables) {
if (err) return console.error(err);
tables.forEach(function(table) {
console.log('Table:', table.getName());
});
});
meta.getColumns('tablename', function(err, columns) {
if (err) return console.error(err);
columns.forEach(function(col) {
console.log(col.getName(), col.getDataType(), col.isNullable());
});
});
});
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.