SchemaSmith Enterprise Documentation

Data Delivery

Easily deliver seed or test data to all your environments

Data Delivery

Overview

In the Community edition, data delivery can be achieved via scripts. SchemaQuench supports those scripts and the TableData quench slot and behavior. The Enterprise Edition expands on this capability by offering the ability to export your data to JSON files and configure tables for automated data delivery. This feature uses the JSON files to generate MERGE scripts dynamically, which are applied immediately prior to the TableData scripts.

If you continue using the TableData scripts, we will loop to resolve dependency order. However, this can be expensive, especially with many tables or complex dependency chains. You can optionally assign names to your scripts, so they will sort to control their execution order and reduce or eliminate the need for looping, though this approach will increase the maintenance burden.

Concept

With data delivery, we traverse the foreign keys to optimize the delivery order. We also use looping to resolve dependencies that cannot be accurately determined up front, such as circular references.

To facilitate this method, you can use DataTongs to capture the necessary JSON files. The AdventureWorks product in demo repository is configured to use data delivery for both seed data and the full set of test data.

At the table level, you can simplify setup and reduce script management by configuring the following four properties in your table's JSON file:


{
  "ContentFile": "TableContents\\Person.AddressType.content",
  "MergeType": "Insert/Update",
  "MatchColumns": "",
  "MergeFilter": ""
}
                            

A complete table JSON with these properties configured can be found at the bottom of this file.

  • The ContentFile and MergeType properties are required.
  • The MatchColumns and MergeFilter properties are optional.

Tip

By default, match columns are automatically determined using the Primary Key if present, or a unique index chosen with preference for the fewest columns and all non-null values. You can override this by specifying custom match columns if needed.

Important

  • The ContentFile path is relative to the template for which the table is defined.
  • The MergeFilter scopes the DELETE operation when included.
  • The supported MergeType values include Insert, Insert/Update, and Insert/Update/Delete.

Additional Resources