
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
extract-pg-schema
Advanced tools
Reads various metadata from your postgres database and return a Javascript object. This package is used by [Kanel](https://github.com/kristiandupont/kanel) to generate Typescript types and [Schemalint](https://github.com/kristiandupont/schemalint) to prov
Reads various metadata from your postgres database and return a Javascript object. This package is used by Kanel to generate Typescript types and Schemalint to provide linting of database schemas.
View the documentation here
npm i extract-pg-schema
You give it a postgres connection config object and some options and it will connect to your database and generate
const { extractSchemas } = require('extract-pg-schema');
async function run() {
const connection = {
host: 'localhost',
database: 'postgres',
user: 'postgres',
password: 'postgres',
};
const result = await extractSchemas(connection);
console.log(result);
}
run();
For an example of a generated object, take a look at dvdrental.json file which is generated from the sample Database from PostgreSQLTutorial.com.
You can also use the CLI to extract the schemas from a database and write it to the console or a file in JSON format.
npx extract-pg-schema -h localhost -p 5432 -U postgres -d postgres > schemas.json
The CLI takes a small subset of the options that pg_dump takes. You can also use the environment variables starting with PG to set the connection parameters.
Usage: extract-pg-schema [options] [DBNAME]
Extract all schemas from a PostgreSQL database and print them as JSON.
Options:
--help show this help
-h, --host=HOSTNAME database server host or socket directory
-p, --port=PORT database server port
-U, --username=USERNAME database user name
-d, --dbname=DBNAME database name to connect to
-n, --schema=SCHEMA include schema regular expression (may be given multiple times)
-N, --exclude-schema=SCHEMA exclude schema regular expression (may be given multiple times)
Made with contrib.rocks.
FAQs
Reads various metadata from your postgres database and return a Javascript object. This package is used by [Kanel](https://github.com/kristiandupont/kanel) to generate Typescript types and [Schemalint](https://github.com/kristiandupont/schemalint) to prov
We found that extract-pg-schema demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.