How dbForge Data Pump is involved in the DevOps process

The need for Data Pump tool in the CI process

By all means, populating databases with test data is incredibly simple with the help of such a powerful tool as dbForge Data Generator. However, you may encounter a situation when need to fill a database with test data from different data files (.csv, .xml, .json, .xls, etc.).

At this point, an equally important tool, dbForge Data Pump, comes into play and the prerequisites for using it can be different.

Firstly, you may need to add files with specific data sets developed by the test department that cover various boundary conditions and you want to ensure that the functionality you are testing always works well on such data sets.

Secondly, you may need to use huge data files exported from your customer’s real database. The customer is willing to share this data with you to make certain that the upgrade will be successful specifically on these data sets.

Thirdly, a customer may send you a file with a data set, also exported from a real database. But with this set, errors occur and bugs appear. After fixing the bugs, the developers want to include these particular data sets during each CI process aiming to perform repeated testing. As you can see from the situations above, files can be a convenient carrier of specific test data and the solution to certain problems.

dbForge Data Pump involvement in the CI process

To use dbForge Data Pump in the CI process, you will need to create a new project.
01
To create a new project, right-click the database table that you want to fill with test data during the CI process. Then select the Import Data menu option.
02
Next, enter a name and select a desired format of the import file, as shown in the picture to the right.
03
Now, on the next pages of the wizard configure all the necessary settings. When the settings are ready, save the template.

Script to use dbForge Data Pump in PowerShell

The following is a PowerShell script invoking the Invoke-DevartDataImport cmdlet, which launches the dbForge Data Pump tool under the hood. As you can see from the script, two parameters are required for the cmdlet input: the name of the data file to be imported and the template.
# Variables
$serverName = "(LocalDb)\MSSQLLocalDB"
$databaseName = "Magma"
$scriptFolder = "D:\Test\ScriptsFolder\"

# A filepath to a dataimport file
$importDataFileName = "D:\Test\CSV\Customer.csv"
$importTemplateFileName = "D:\Test\CSV\import_customer_template.dit"

# Create database connection
Write-Host "Creating database connection..."
$connection = New-DevartSqlDatabaseConnection -Server $serverName -Database $databaseName -WindowsAuthentication $true

# Test database connection
Write-Host "Testing database connection..."
$result = Test-DevartDatabaseConnection -Connection $connection;

# Import sample data from a file to certain table
Write-Host "Importing sample data from a file..."
$result = Invoke-DevartDataImport -InputFile $importDataFileName -TemplateFile $importTemplateFileName

Conclusion

dbForge Data Pump facilitates the DevOps process, giving an ability to manipulate data of various volumes from different sources.

Learn about other dbForge tools involved in collaborative
database development and deployment