{"id":18660,"library":"pg-anonymizer","title":"pg-anonymizer","description":"pg-anonymizer is a CLI tool (built with oclif) that exports a PostgreSQL database and anonymizes sensitive columns using faker.js. It wraps pg_dump and replaces data on the fly. Current stable version 0.8.1, released Feb 2024, with ~5 releases per year. Key differentiators: no database installation, works as a pipe, supports custom faker functions, extension files, and config files. Alternative to pg_dump with custom scripts or postgresql_anonymizer, but simpler and portable.","status":"active","version":"0.8.1","language":"javascript","source_language":"en","source_url":"https://github.com/rap2hpoutre/pg-anonymizer","tags":["javascript","oclif","typescript"],"install":[{"cmd":"npm install pg-anonymizer","lang":"bash","label":"npm"},{"cmd":"yarn add pg-anonymizer","lang":"bash","label":"yarn"},{"cmd":"pnpm add pg-anonymizer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required system tool for dumping the database; the CLI calls pg_dump internally.","package":"pg_dump","optional":false}],"imports":[{"note":"ESM and CJS both supported (dual package). The default export is the CLI runner.","wrong":"const pgAnonymizer = require('pg-anonymizer')","symbol":"default","correct":"import pgAnonymizer from 'pg-anonymizer'"},{"note":"Named export for programmatic usage; available since v0.6.","wrong":"const { anonymize } = require('pg-anonymizer')","symbol":"anonymize","correct":"import { anonymize } from 'pg-anonymizer'"},{"note":"TypeScript types are bundled; use import type for type-only imports.","wrong":"","symbol":"types","correct":"import type { Config } from 'pg-anonymizer'"}],"quickstart":{"code":"npx pg-anonymizer postgres://user:pass@localhost:5432/mydb --columns=email,firstName,lastName --output dump.sql","lang":"typescript","description":"Anonymize a PostgreSQL database export by specifying columns to anonymize, using npx without installation."},"warnings":[{"fix":"Install PostgreSQL client tools (e.g., apt-get install postgresql-client) or ensure pg_dump is in PATH.","message":"pg_dump must be installed separately; it is not bundled with npm package.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If you relied on faker.random.word default, specify columns explicitly with ':faker.random.word'.","message":"v0.6.0 changed default faker from faker.random.word to auto-detection based on column name; custom --columns without faker function now auto-detects.","severity":"breaking","affected_versions":">=0.6.0 <0.7.0"},{"fix":"Use --skip to exclude tables from anonymization instead of prefixing column names.","message":"The --columns option with dot-notation for tables (e.g., public.user.email) may be deprecated in future; prefer using --skip for tables.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"Always specify --columns to avoid accidentally anonymizing unintended columns.","message":"Unexpected anonymization of non-sensitive columns: if no --columns specified, a default list of columns (email, name, etc.) is anonymized, potentially including non-sensitive data.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use absolute paths for --output to avoid confusion.","message":"Output file path is relative to current working directory, not the script location.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade Node.js to >=12.","message":"Node.js >=12 required; Node 10 support dropped in v0.6.0.","severity":"deprecated","affected_versions":">=0.6.0"}],"env_vars":null,"search_vec":"'0.8.1':38 '2024':41 '5':43 'altern':65 'anonym':3,6,20,74 'built':11 'cli':9 'column':22 'config':63 'current':35 'custom':57,70 'data':31 'databas':18,50 'differenti':48 'dump':28,68 'export':15 'extens':60 'faker':58 'faker.js':24 'feb':40 'file':61,64 'fli':34 'function':59 'instal':51 'javascript':79 'key':47 'oclif':13,80 'per':45 'pg':2,5,27,67 'pg-anonym':1,4 'pipe':55 'portabl':78 'postgresql':17,73 'releas':39,44 'replac':30 'script':71 'sensit':21 'simpler':76 'stabl':36 'support':56 'tool':10 'typescript':81 'use':23 'version':37 'work':52 'wrap':26 'year':46","created_at":"2026-04-25T07:39:27.943587+00:00","updated_at":"2026-04-25T07:39:27.943587+00:00","problems":[{"fix":"Install PostgreSQL client tools (e.g., on Ubuntu: sudo apt-get install postgresql-client).","cause":"pg_dump is not installed on the system.","error":"pg_dump: command not found"},{"fix":"Use dynamic import() or switch to ESM: 'import pgAnonymizer from \"pg-anonymizer\"'.","cause":"When using require in an older CJS project without transpilation, but package is ESM-only in some versions.","error":"Error: Cannot find module 'pg-anonymizer'"},{"fix":"Check the column name spelling and ensure it exists in the database.","cause":"Specified a column name that does not exist in any database table.","error":"Error: Column 'nonexistent' does not exist in any table"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"pg-anonymizer","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/rap2hpoutre/pg-anonymizer","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/pg-anonymizer","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","devops","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}