All Projects → rap2hpoutre → Pg Anonymizer

rap2hpoutre / Pg Anonymizer

Licence: mit
Dump anonymized PostgreSQL database with a NodeJS CLI

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Pg Anonymizer

Dbbench
🏋️ dbbench is a simple database benchmarking tool which supports several databases and own scripts
Stars: ✭ 52 (-37.35%)
Mutual labels:  database, postgresql
Powa Web
PoWA user interface
Stars: ✭ 66 (-20.48%)
Mutual labels:  database, postgresql
Pgtune
Pgtune - tuning PostgreSQL config by your hardware
Stars: ✭ 1,078 (+1198.8%)
Mutual labels:  database, postgresql
Perfect Postgresql
A stand-alone Swift wrapper around the libpq client library, enabling access to PostgreSQL servers.
Stars: ✭ 48 (-42.17%)
Mutual labels:  database, postgresql
Plv8
V8 Engine Javascript Procedural Language add-on for PostgreSQL
Stars: ✭ 1,195 (+1339.76%)
Mutual labels:  database, postgresql
Postgresclientkit
A PostgreSQL client library for Swift. Does not require libpq.
Stars: ✭ 49 (-40.96%)
Mutual labels:  database, postgresql
Scalikejdbc
A tidy SQL-based DB access library for Scala developers. This library naturally wraps JDBC APIs and provides you easy-to-use APIs.
Stars: ✭ 1,139 (+1272.29%)
Mutual labels:  database, postgresql
Awesome Postgres
A curated list of awesome PostgreSQL software, libraries, tools and resources, inspired by awesome-mysql
Stars: ✭ 7,468 (+8897.59%)
Mutual labels:  database, postgresql
Postgresql Provider
PostgreSQL Provider for the Vapor web framework.
Stars: ✭ 71 (-14.46%)
Mutual labels:  database, postgresql
Zabbixdba
Zabbix Database Monitoring Service (Oracle, Pg, MySQL, MS SQL, DB2, etc.)
Stars: ✭ 68 (-18.07%)
Mutual labels:  database, postgresql
Niklick
Rails Versioned API solution template for hipsters! (Ruby, Ruby on Rails, REST API, GraphQL, Docker, RSpec, Devise, Postgress DB)
Stars: ✭ 39 (-53.01%)
Mutual labels:  database, postgresql
Suricatta
High level sql toolkit for clojure (backed by jooq library)
Stars: ✭ 77 (-7.23%)
Mutual labels:  database, postgresql
Goqu
SQL builder and query library for golang
Stars: ✭ 984 (+1085.54%)
Mutual labels:  database, postgresql
Hunt Entity
An object-relational mapping (ORM) framework for D language (Similar to JPA / Doctrine), support PostgreSQL and MySQL.
Stars: ✭ 51 (-38.55%)
Mutual labels:  database, postgresql
Laravel Pg Extensions
Laravel extensions for Postgres
Stars: ✭ 33 (-60.24%)
Mutual labels:  database, postgresql
Squid
🦑 Provides SQL tagged template strings and schema definition functions.
Stars: ✭ 57 (-31.33%)
Mutual labels:  database, postgresql
Node Pg Migrate
Node.js database migration management for Postgresql
Stars: ✭ 838 (+909.64%)
Mutual labels:  database, postgresql
Go Kallax
Kallax is a PostgreSQL typesafe ORM for the Go language.
Stars: ✭ 853 (+927.71%)
Mutual labels:  database, postgresql
Dbmigrations
A library for the creation, management, and installation of schema updates for relational databases.
Stars: ✭ 67 (-19.28%)
Mutual labels:  database, postgresql
Node Sql Fixtures
SQL fixtures for Node.js in PostgreSQL, MySQL, MariaDB and SQLite
Stars: ✭ 76 (-8.43%)
Mutual labels:  database, postgresql

pg-anonymizer

Export your PostgreSQL database anonymized. Replace all sensitive data thanks to faker. Output to a file that you can easily import with psql.

oclif Version Downloads License

Usage

Run this command by giving a connexion string and an output file name (no need to install first thanks to npx):

npx pg-anonymizer postgres://user:[email protected]:1234/mydb -o dump.sql

☝️ This command requires pg_dump. It may already be installed as soon as PostgreSQL is installed.

Specify list of columns to anonymize

Use --list option with a comma separated list of column name:

npx pg-anonymizer postgres://localhost/mydb \
  --list=email,firstName,lastName,phone

Specifying another list via --list replace the default automatically anonymized values:

email,name,description,address,city,country,phone,comment,birthdate

Customize replacements

You can also choose which faker function you want to use to replace data (default is faker.random.word):

npx pg-anonymizer postgres://localhost/mydb \
  --list=firstName:faker.name.firstName,lastName:faker.name.lastName

👉 You don't need to specify faker function since the command will try to find correct function via column name.

You can use plain text too for static replacements:

npx pg-anonymizer postgres://localhost/mydb \
  --list=textcol:hello,jsoncol:{},intcol:12

Memory limit

Use -m to change pg_dump output memory limit (e.g: 512)

Locale (i18n)

Use -l to change the locale used by faker (default: en)

Import the anonymized file

The anonymized output file is plain SQL text, you can import it with psql.

psql -d mylocaldb < output.sql

Why

There are a bunch of competitors, still I failed to use them:

  • postgresql_anonymizer may be hard to setup and may be cumbersome for simple usage. Still, I guess it's the best solution.
  • pganonymize fails when it does not use public schema or columns have uppercase characters
  • pganonymizer also fails with simple cases. Errors are not explicit and silent.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].