Production to test with privacy, two separate databases, PostgreSQL

I have a large production database and need only partial, secured data for two databases

Source production database is large; 1TB that includes 100 tables and customer sensitive data.

To generate two databases for tests, we need only a small part of the production database: 4 tables with relevant data from the last 3 months, around 50G. Considering privacy regulations, we also need to mask sensitive data.

Test data total generation time is 10 minutes and is being executed twice into two different databases