
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@pgkit/schemainspect
Advanced tools
schemainspect
: SQL Schema Inspection for PostgreSQLInspects tables, views, materialized views, constraints, indexes, sequences, enums, functions, and extensions. Handles table partitioning and inheritance.
A port of @djrobstep's python schemainspect library.
Limitations: Function inspection only confirmed to work with SQL/PLPGSQL languages so far.
Install with npm:
npm install @pgkit/schemainspect
Get an inspection object from an already opened SQLAlchemy session or connection as follows:
import {PostgreSQL} from '@pgkit/schemainspect'
const inspector = await PostgreSQL.create('postgresql://')
console.log(inspector.tables)
console.log(inspector.views)
console.log(inspector.functions)
console.log(inspector.tables[`"public"."mytable"`].schema)
console.log(inspector.tables[`"public"."mytable"`].name)
console.log(inspector.tables[`"public"."mytable"`].columns.mycolumn.dbtype)
console.log(inspector.tables[`"public"."mytable"`].columns.mycolumn.is_nullable)
The inspection object has attributes for tables, views, and all the other things it tracks. At each of these attributes you'll find a dictionary (Record<string, ...>
) mapping from fully-qualified-and-quoted-name-of-thing-in-database to information object.
For instance, the information about a table books would be accessed as follows:
>>> books_table = i.tables['"public"."books"']
>>> books_table.name
'books'
>>> books_table.schema
'public'
>>> [each.name for each in books_table.columns]
['id', 'title', 'isbn']
Documentation is a bit patchy at the moment. Watch this space!
Initial development, maintenance:
TypeScript port:
Contributions:
FAQs
SQL Schema Inspection for PostgreSQL
The npm package @pgkit/schemainspect receives a total of 796 weekly downloads. As such, @pgkit/schemainspect popularity was classified as not popular.
We found that @pgkit/schemainspect 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.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.