Bỏ qua

Domain generators

Warning

The current page still doesn't have a translation for this language.

But you can help translating it: Contributing.

AcademicTitleGenerator

Generate locale-aware academic titles from the configured dataset.

Why: Use AcademicTitleGenerator when person records need locale-specific academic titles with a controlled prevalence; omit the field rather than generating an empty title when the target does not model titles.

Category: person.

Output: str | null.

1
<key name="value" generator="AcademicTitleGenerator(dataset='DE', quota=0.2)"/>

Parameters

  • dataset: str | null; Default None — Country dataset that supplies locale-appropriate academic titles.
  • quota: float; Default 0.5 — Probability that a generated record receives a title instead of no value.

CNPJGenerator

Generate formatted Brazilian CNPJ business-registration numbers.

Why: Use CNPJGenerator for Brazilian organization fixtures that require formatted CNPJ-shaped tax identifiers; use CPFGenerator for individual taxpayers.

Category: br.

Output: str.

1
<key name="value" generator="CNPJGenerator()"/>

CPFGenerator

Generate formatted Brazilian CPF individual taxpayer numbers.

Why: Use CPFGenerator for Brazilian person fixtures that require formatted CPF-shaped taxpayer identifiers; use CNPJGenerator for organizations.

Category: br.

Output: str.

1
<key name="value" generator="CPFGenerator()"/>

CompanyNameGenerator

Generate synthetic organization names from built-in name fragments.

Why: Use CompanyNameGenerator for varied synthetic organization names without loading a source dataset; use the Company entity when legal form, address, sector, and contacts must remain coherent.

Category: organization.

Output: str.

1
<key name="value" generator="CompanyNameGenerator()"/>

DataFakerGenerator

Generate locale-aware values through a named Python Faker provider.

Why: Use DataFakerGenerator when a named Faker provider supplies the required locale-aware value; the selected provider owns the concrete output type.

Category: faker.

Output: method-specific Faker value.

1
<key name="value" generator="DataFakerGenerator(method='name', locale='en_US')"/>

Parameters

  • method: str; Default required — Public Python Faker provider method invoked for each generated value.
  • locale: str | null; Default en_US — Faker locale used to load provider data and formatting rules.

DepartmentNameGenerator

Generate organization department names from a locale-aware dataset.

Why: Use DepartmentNameGenerator for organization structures that need realistic localized department labels; use a weighted source list when the organization has a fixed taxonomy.

Category: organization.

Output: str.

1
<key name="value" generator="DepartmentNameGenerator(locale='en_US')"/>

Parameters

  • locale: str | null; Default None — Locale used to choose the department-name dataset.

DomainGenerator

Generate internet domain names from a country-specific weighted dataset.

Why: Use DomainGenerator for country-weighted internet domains or as the correlated domain part of email addresses; use a source reference when domains must belong to known customers.

Category: net.

Output: str.

1
<key name="value" generator="DomainGenerator(dataset='US')"/>

Parameters

  • dataset: str | null; Default None — Country dataset that weights top-level domains and name fragments.

EANGenerator

Generate EAN-13 product codes, optionally unique within one process.

Why: Use EANGenerator for product fixtures that need EAN-13-shaped identifiers; enable unique only for bounded single-process pools and use a key strategy when global uniqueness is required.

Category: ecommerce.

Output: str.

1
<key name="value" generator="EANGenerator(locale='en_US', unique=True)"/>

Parameters

  • locale: str | null; Default en_US — Faker locale used by the barcode provider.
  • unique: bool; Default False — Whether the in-process Faker provider must avoid repeated EAN values.

EmailAddressGenerator

Generate dataset-aware email addresses, optionally based on a person's name.

Why: Use EmailAddressGenerator when email values should correlate with a person's supplied name and regional domain data; use DataFakerGenerator for an unrelated standalone email.

Category: person.

Output: str.

1
<key name="value" generator="EmailAddressGenerator(dataset='US', given_name='Avery', family_name='Miller')"/>

Parameters

  • dataset: str | null; Default None — Country dataset used for names and domain weighting.
  • given_name: str | null; Default None — Optional given name embedded into the local part.
  • family_name: str | null; Default None — Optional family name embedded into the local part.

FamilyNameGenerator

Generate locale-aware family names from the configured dataset.

Why: Use FamilyNameGenerator when family names must follow one explicit regional dataset.

Category: person.

Output: str.

1
<key name="value" generator="FamilyNameGenerator(dataset='US')"/>

Parameters

  • dataset: str | null; Default required — Country dataset that supplies weighted family names.

GenderGenerator

Generate female, male, or other values using configurable quotas.

Why: Use GenderGenerator when demographic fixtures require explicit female, male, and other proportions; use a source value when categories or quotas come from governed production data.

Category: person.

Output: str.

1
<key name="value" generator="GenderGenerator(female_quota=0.49, other_gender_quota=0.02)"/>

Parameters

  • female_quota: float | null; Default None — Probability assigned to the female category.
  • other_gender_quota: float | null; Default None — Probability assigned to the other category; the remainder is male.

GivenNameGenerator

Generate locale-aware given names, optionally constrained by gender.

Why: Use GivenNameGenerator when synthetic names must follow one regional dataset and optionally correlate with gender; use the Person entity when name, address, contact, and demographics must be coherent together.

Category: person.

Output: str.

1
<key name="value" generator="GivenNameGenerator(dataset='US', gender='female')"/>

Parameters

  • dataset: str | null; Default None — Country dataset that supplies weighted given names.
  • gender: str | null; Default None — Optional gender category used to select the corresponding name pool.

IbanGenerator

Generate a structurally valid ISO 13616 IBAN for the dataset's country.

Why: Use IbanGenerator for test payment accounts that need a country-shaped IBAN with a valid checksum; use a source reference instead when existing account identity must be preserved.

Category: finance.

Output: str.

1
<key name="value" generator="IbanGenerator(dataset='DE')"/>

Parameters

  • dataset: str | None; Default None — ISO country dataset that determines the IBAN length and structure.

MedicalLicenseGenerator

Generate state-prefixed medical licence identifiers.

Why: Use MedicalLicenseGenerator when synthetic clinician records need recognisable state-scoped licence keys; use NpiGenerator when the requirement is a national provider identifier.

Category: healthcare.

Output: str.

1
<key name="value" generator="MedicalLicenseGenerator(dataset='US', states=['CA', 'NY'], digits=7)"/>

Parameters

  • dataset: str | None; Default None — Country dataset used to resolve supported state or region codes.
  • states: Iterable[str] | None; Default None — Allowed state or region prefixes sampled for each licence.
  • digits: int; Default 6 — Number of numeric characters appended to the selected prefix.

NobilityTitleGenerator

Generate locale-aware nobility titles from the configured dataset.

Why: Use NobilityTitleGenerator when locale-specific person fixtures deliberately model rare nobility titles; omit it when the business schema has no title concept.

Category: person.

Output: str | null.

1
<key name="value" generator="NobilityTitleGenerator(dataset='DE', gender='female', noble_quota=0.05)"/>

Parameters

  • dataset: str | null; Default None — Country dataset supplying locale-specific nobility titles.
  • gender: str | null; Default None — Optional gender category used to select matching titles.
  • noble_quota: float | null; Default None — Probability that a row receives a nobility title instead of no value.

NpiGenerator

Generate 10-digit National Provider Identifiers.

Why: Use NpiGenerator when US healthcare test records need NPI-shaped provider identifiers; use MedicalLicenseGenerator for state-scoped licence values.

Category: healthcare.

Output: str.

1
<key name="value" generator="NpiGenerator()"/>

PasswordGenerator

Generate secure passwords with configurable complexity.

Why: Use PasswordGenerator for authentication test fixtures that must satisfy explicit character-class complexity; never use generated values as production credentials.

Category: net.

Output: str.

1
<key name="value" generator="PasswordGenerator(length=16, include_special=True, include_numbers=True, include_uppercase=True)"/>

Parameters

  • length: int; Default 16 — Total password length; must meet the implementation's minimum.
  • include_special: bool; Default True — Whether at least one supported special character is included.
  • include_numbers: bool; Default True — Whether at least one numeric character is included.
  • include_uppercase: bool; Default True — Whether at least one uppercase character is included.

PhoneNumberGenerator

Generate locale-aware phone numbers from the configured dataset.

Why: Use PhoneNumberGenerator for locale-shaped contact fixtures with optional area-code or mobile constraints; use a source reference when numbers must preserve existing customer identity.

Category: address.

Output: str.

1
<key name="value" generator="PhoneNumberGenerator(dataset='US', area_code='415', is_mobile=True)"/>

Parameters

  • dataset: str | null; Default None — Country dataset controlling the phone-number shape.
  • area_code: str | null; Default None — Optional area code forced into the generated number.
  • is_mobile: bool; Default False — Optional flag selecting a mobile rather than general number pattern.

PlanCodeGenerator

Generate deterministic plan codes with configurable prefix and length.

Why: Use PlanCodeGenerator for compact catalogue keys whose business prefix identifies a plan family; use PrefixedIdGenerator when the body must follow a non-numeric pattern.

Category: insurance.

Output: str.

1
<key name="value" generator="PlanCodeGenerator(prefix='HMO', digits=5)"/>

Parameters

  • prefix: str | None; Default None — Business prefix placed before the numeric plan-code body.
  • digits: int; Default 6 — Fixed number of digits in the generated body.

PolicyNumberGenerator

Generate policy numbers with alphabetic and numeric sections.

Why: Use PolicyNumberGenerator for insurance policy identifiers with recognisable prefix, letter, and digit sections; use PrefixedIdGenerator when a regex-like body is the real contract.

Category: insurance.

Output: str.

1
<key name="value" generator="PolicyNumberGenerator(prefix='POL', alpha=2, digits=8)"/>

Parameters

  • prefix: str; Default POL — Fixed business prefix at the start of each policy number.
  • alpha: int; Default 3 — Number of uppercase letters generated after the prefix.
  • digits: int; Default 8 — Number of digits generated after the alphabetic section.

RoutingNumberGenerator

Generate a 9-digit ABA routing number with checksum validation.

Why: Use RoutingNumberGenerator for US banking fixtures that require an ABA-compatible checksum; do not treat the generated value as an identifier of a real institution.

Category: finance.

Output: str.

1
<key name="value" generator="RoutingNumberGenerator(prefix='021000')"/>

Parameters

  • prefix: str | None; Default None — Optional leading digits retained before the checksum is calculated.

SSNGenerator

Generate locale-aware social-security identification numbers through Faker.

Why: Use SSNGenerator for locale-shaped social-security identifiers in synthetic person records; use Hash on a source identifier when stable de-identification is required.

Category: us.

Output: str.

1
<key name="value" generator="SSNGenerator(locale='en_US')"/>

Parameters

  • locale: str | null; Default en_US — Faker locale selecting the social-security-number provider.

SectorGenerator

Generate industry-sector names from a country-specific dataset.

Why: Use SectorGenerator for organization fixtures that need country- or locale-appropriate industry sectors; use a weighted source list when a governed sector taxonomy is authoritative.

Category: organization.

Output: str.

1
<key name="value" generator="SectorGenerator(dataset='US', locale='en_US')"/>

Parameters

  • dataset: str | null; Default None — Country dataset used when no explicit locale is supplied.
  • locale: str | null; Default None — Optional locale that overrides dataset selection for sector labels.

StreetNameGenerator

Generate locale-aware street names from the configured dataset.

Why: Use StreetNameGenerator for standalone locale-aware street labels; use the Address entity when street, city, postcode, region, and contact fields must be coherent.

Category: address.

Output: str.

1
<key name="value" generator="StreetNameGenerator(dataset='US')"/>

Parameters

  • dataset: str | null; Default None — Country dataset that supplies weighted street names.

TaxIdGenerator

Generate deterministic, country-flavored tax IDs without external data files.

Why: Use TaxIdGenerator for deterministic country-flavoured tax-ID fixtures when exact national validation is not required; use CPF or CNPJ for their supported Brazilian identifier shapes.

Category: finance.

Output: str.

1
<key name="value" generator="TaxIdGenerator(dataset='DE')"/>

Parameters

  • dataset: str | null; Default None — Country dataset controlling the prefix and numeric shape.

TokenGenerator

Generate various types of secure tokens.

Why: Use TokenGenerator for opaque synthetic session, API, or reset-token fixtures with a chosen encoding; never use generated values as production security tokens.

Category: net.

Output: str | bytes.

1
<key name="value" generator="TokenGenerator(token_type='urlsafe', entropy=32)"/>

Parameters

  • token_type: str; Default hex — Output encoding: hexadecimal, raw bytes, or URL-safe Base64.
  • entropy: int; Default 32 — Number of random input bytes before encoding.

UrlGenerator

Generate locale-aware URLs with optional allowed schemes.

Why: Use UrlGenerator for locale-aware web-address fixtures constrained to allowed schemes; use DomainGenerator when only the host name is required.

Category: net.

Output: str.

1
<key name="value" generator="UrlGenerator(locale='en_US', schemes=['https'])"/>

Parameters

  • locale: str | null; Default None — Faker locale used to generate URL components.
  • schemes: list[str] | null; Default None — Allowed URI schemes; generated values are rewritten to one of these schemes.