pg-snapshot

1.16.0 • Public • Published

PG Snapshot

Small tool to create a snapshot of an actual node-pg query in JSON format. It helps to write fixtures data for unit testing

Usage

pg-snapshot reads connection data from env

  • PGUSER
  • PGHOST
  • PGDATABASE
  • PGPASSWORD

and sql command from stdin. Enter twice to send the query.

Example

PGHOST=my_pg_server_hostname PGPASSWORD=my_password PGDATABASE=my_db_name PGUSER=dba node index.js
SELECT * FROM MY_TABLE
WHERE awesomeness >= 9000
<enter>
<enter>
QUERYING
WRITING TO DISK
DONE
closing PG connection pool on exit

after the command completes, you will have a json file at the working dir. And that's it

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i pg-snapshot

    Weekly Downloads

    11

    Version

    1.16.0

    License

    none

    Last publish

    Collaborators

    • tungv