Add parameter to AnonymizedFaker()
and RegexGenerator()
to generate only unique values
#542
Labels
feature request
Request for a new feature
Milestone
Problem Description
To effectively use
AnonymizedFaker
andRegexGenerator
on data such as primary keys, I need to ensure that the anonymized data created during thereverse_transform
stage is unique.Expected behavior
Parameters
Add parameter
enforce_uniqueness
that controls whether the data should be unique.False
: No guarantees that the anonymized data is uniqueTrue
: Guarantee that the anonymized data will be uniqueFunctionality
If
enforce_uniqueness=True
then:reverse_transform
: Ensure that the new, anonymized data is all unique. If it isn't possible to create the requested number of rows, then raise an errorBackwards Compatibility
This change is backwards compatible.
The
enforce_uniqueness
parameter is optional and assumed to beFalse
if it's not provided. This is the current functionality.The text was updated successfully, but these errors were encountered: