> For the complete documentation index, see [llms.txt](https://docs.tonic.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonic.ai/app/workflows/data-generation-run-job/data-generation-types.md).

# Types of data generation

## Simple data generation <a href="#data-generation-types-simple" id="data-generation-types-simple"></a>

In the simplest type of data generation, Tonic Structural uses the configured table modes and generators to transform data in the source database and then write the transformed data to the destination location. The destination location is usually a database server, but might also be:

* A storage location such as an S3 bucket.
* A container repository.

For a [file connector](/app/setting-up-your-database/file-connector.md) workspace, the data generation job uses the configured generators for each file group to transform the data in the source files. The transformed data is used to create output files that correspond to the source files.

<figure><img src="https://3378426797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LSQCLFQ4bslJ-HYc8c3%2Fuploads%2FYDDfFMraUQT6ZrYqoEx9%2FDataGenerationRegular.png?alt=media&amp;token=cb39c13d-4430-46ac-9726-d846d77a52d0" alt=""><figcaption><p>Simple data generation process</p></figcaption></figure>

## Subsetting data generation <a href="#data-generation-types-subsetting" id="data-generation-types-subsetting"></a>

When [subsetting](/app/generation/subsetting.md) is enabled, Structural first identifies the tables and rows to include in the subset. It uses the configured table modes and generators to transform the data. It then writes the transformed data to the destination location.

<figure><img src="https://3378426797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LSQCLFQ4bslJ-HYc8c3%2Fuploads%2F1diH24EnfSeleTMhW6SL%2FDataGenerationSubset.png?alt=media&amp;token=a0a51ad0-ffd1-409f-b351-4804f4a2d0eb" alt=""><figcaption><p>Data generation process with subsetting</p></figcaption></figure>

## Upsert data generation <a href="#data-generation-types-upsert" id="data-generation-types-upsert"></a>

When [upsert](/app/workspace/workspace-configuration-settings/workspace-config-upsert.md) is enabled, Structural runs a data generation job that writes the transformed data to an intermediate database. The data generation can include subsetting.

After the initial data generation, Structural runs an upsert job to add or update the appropriate records from the intermediate database to the destination database. The upsert job only adds and updates records. It does not remove any records from previous data generation jobs.&#x20;

<figure><img src="https://3378426797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LSQCLFQ4bslJ-HYc8c3%2Fuploads%2Fav3RDfU41BRVveGNiX6b%2FDataGenerationUpsert.png?alt=media&amp;token=47d3a9b2-6132-42da-98e9-d0701be6daf2" alt=""><figcaption><p>Data generation process with upsert</p></figcaption></figure>

Before Structural can run an upsert job, the destination database must already exist and have the correct schema defined. To initialize the destination database:

1. Disable upsert.
2. Run a regular data generation.
3. Re-enable upsert.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tonic.ai/app/workflows/data-generation-run-job/data-generation-types.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
