commands

^

Invoke-DbaDbDataGenerator

Author Sander Stad (@sqlstad, sqlstad.nl)
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Invoke-DbaDbDataGenerator on GitHub.
Want to see the Bill Of Health for this command? Check out Invoke-DbaDbDataGenerator.

Synopsis

Invoke-DbaDbDataGenerator generates random data for tables

Description

Invoke-DbaDbDataMasking is able to generate random data for tables.

Syntax

Invoke-DbaDbDataGenerator
    [[-SqlInstance] <DbaInstanceParameter[]>]
    [[-SqlCredential] <PSCredential>]
    [[-Database] <String[]>]
    [-FilePath] <Object>
    [[-Locale] <String>]
    [[-CharacterString] <String>]
    [[-Table] <String[]>]
    [[-Column] <String[]>]
    [[-ExcludeTable] <String[]>]
    [[-ExcludeColumn] <String[]>]
    [[-MaxValue] <Int32>]
    [-ExactLength]
    [[-ModulusFactor] <Int32>]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Invoke-DbaDbDataGenerator -SqlInstance sqldb2 -Database DB1 -FilePath C:\temp\sqldb1.db1.tables.json

Apply the data generation configuration from the file "sqldb1.db1.tables.json" to the db1 database on sqldb2. Prompt for confirmation for each table.

Required Parameters

-FilePath

Configuration file that contains the which tables and columns need to be masked

Alias Path,FullName
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-SqlInstance

The target SQL Server instance or instances.

Alias
Required False
Pipeline false
Default Value
-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-Database

Databases to process through

Alias
Required False
Pipeline false
Default Value
-Locale

Set the local to enable certain settings in the masking

Alias
Required False
Pipeline false
Default Value en
-CharacterString

The characters to use in string data. 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' by default

Alias
Required False
Pipeline false
Default Value abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
-Table

Tables to process. By default all the tables will be processed

Alias
Required False
Pipeline false
Default Value
-Column

Columns to process. By default all the columns will be processed

Alias
Required False
Pipeline false
Default Value
-ExcludeTable

Exclude specific tables even if it's listed in the config file.

Alias
Required False
Pipeline false
Default Value
-ExcludeColumn

Exclude specific columns even if it's listed in the config file.

Alias
Required False
Pipeline false
Default Value
-MaxValue

Force a max length of strings instead of relying on datatype maxes. Note if a string datatype has a lower MaxValue, that will be used instead.
Useful for adhoc updates and testing, otherwise, the config file should be used.

Alias
Required False
Pipeline false
Default Value 0
-ExactLength

Mask string values to the same length. So 'Tate' will be replaced with 4 random characters.

Alias
Required False
Pipeline false
Default Value False
-ModulusFactor

Calculating the next nullable by using the remainder from the modulus. Default is every 10.

Alias
Required False
Pipeline false
Default Value 10
-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.

Alias
Required False
Pipeline false
Default Value False
-WhatIf

If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.

Alias cf
Required False
Pipeline false
Default Value