custom_fake_data
Custom Fake Data
This extension is delivered with a small set of fake data by default. For each
fake function ( fake_email(), fake_first_name()) we provide only 1000 unique
values, and they are only in English.
The data is stored in dedicated tables inside the anon schema.
Here’s how you can create your own set of fake data!
Alternative fake data packages
The project is offering alternative fake datasets (currently only French). You can download the zip file containing the dataset and load it into the extension like this:
Go to https://gitlab.com/dalibo/postgresql_anonymizer/-/packages
Click on “data”
Choose your preferred zip file and download it on your server
Unzip the file into a folder (for example
/path/to/custom_csv_files/)Run
SELECT anon.init('/path/to/custom_csv_files/')
Generate your own fake dataset
Just add data inside the fake data tables.
For instance, You can generate fake data using the dummy_* functions:
INSERT INTO anon.email(val,locale)
SELECT anon.dummy_email('fr_FR'), 'fr_FR';
SELECT setval('anon.email_oid_seq', max(oid))
FROM anon.email;
CLUSTER anon.email;Load your own fake data
If you want to use your own dataset, you can import custom CSV files with :
SELECT anon.init('/path/to/custom_csv_files/')Look at the data folder to find the format of the CSV files.
Using the PostgreSQL Faker extension
If you need more specialized fake data sets, please read the Advanced Faking section.