/pg_dummy

simple cli to load pg database schema and save all of the tables content as `csv`/`json` files in a folder.

Primary LanguageTypeScript

pg_dummy

simple cli to load pg database schema and save all of the tables content as csv/json files in a folder.

i had use case where i needed some tool to backup postgres db tables to files, this does that in a simple way.

NOTE, THIS IS NOT INTENDED AS PRODUCTION BACKUP TOOL, ONLY FOR SIMPLE FILE EXPORTS.

i should mention @LORENZO ALBERTON article it was very helpful in extracting db schema check it out here EXTRACTING META INFORMATION FROM POSTGRESQL (INFORMATION_SCHEMA)

for more information check postgres docs.

if you need production backup tool use pg_dump instead, but i would recommend using your db provider backup functionality.

Getting Started

this project uses bun

  • install deps bun install

  • the cli is built using commander so you can run bun start --help to see available commands

Commands list

  • extract as json bun start json

  • extract as csv bun start csv

  • apply some json dump bun start apply <folderPath>

Apply the data to another db

problems need to be fixed