Thor Logo dbatools

Get-DbaRandomizedDatasetTemplate

View Source
Sander Stad (@sqlstad, sqlstad.nl)
Windows, Linux, macOS

Synopsis

Retrieves JSON template files that define column structures for generating realistic test data

Description

Retrieves JSON template files from default and custom directories that define how to generate realistic test datasets. These templates specify column names, data types, and semantic subtypes (like Name.FirstName, Address.City) for creating structured sample data for development and testing environments. The default templates include PersonalData with common fields like names, addresses, and birthdates, and you can specify custom template directories to include organization-specific data patterns.

Syntax

Get-DbaRandomizedDatasetTemplate
    [[-Template] <String[]>]
    [[-Path] <String[]>]
    [-ExcludeDefault]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaRandomizedDatasetTemplate

Get the templates from the default directory

Example: 2
PS C:\> Get-DbaRandomizedDatasetTemplate  -Template Personaldata, Test

Get the templates from thedefault directory and filter on PersonalData and Test

Example: 3
PS C:\> Get-DbaRandomizedDatasetTemplate  -Path C:\DatasetTemplates

Get the templates from a custom directory

Optional Parameters

-Template

Specifies which template files to retrieve by name (without the .json extension).
Use this to filter results when you only need specific templates like “PersonalData” or custom templates.
If not specified, all available templates from the specified paths are returned.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-Path

Specifies one or more directory paths containing custom JSON template files for data generation.
Use this when your organization has created custom templates beyond the default dbatools templates.
Templates from these paths are added to the default templates unless -ExcludeDefault is specified.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-ExcludeDefault

Excludes the built-in dbatools templates from the results.
Use this when you only want to work with custom templates from specified paths.
The default templates include common data patterns like PersonalData with names, addresses, and dates.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with “sea of red” exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this “nice by default” feature off and enables you to catch exceptions with your own try/catch.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse