# create\_test\_generation\_session

```python
def create_test_generation_session(
    *,
    run: Run,
    columns: Optional[list[str | dict[Literal["name"], str]]] = None,
) -> TestGenerationSession
```

If a TestSession has completed and some of the generated Tests had incorrect outcomes, you can tell Distributional that these tests should have had different results.

{% hint style="info" %}
Only applies to Tests generated by Distributional, not custom Tests
{% endhint %}

## Parameters

| Arguments | Description                                                                                                                                                                                                                  |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `run`     | The [Run](/v0.20.x/using-distributional/python-sdk/sdk-objects/run.md) to use when generating tests.                                                                                                                         |
| `columns` | Either a list of column names or a list of dictionaries with only 1 key, "name". These names must refer to the columns in the Run that dbnl will use to generate Tests. If `None`, then all columns in the Run will be used. |

## Returns

<table><thead><tr><th width="300">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>TestGenerationSession</code></td><td>The TestGenerationSession object that was created. The <code>status</code> can be checked to determine when test generation is complete.</td></tr></tbody></table>

## Examples

The following 2 examples are equivalent:

```python
run = dbnl.get_run(...)
dbnl.experimental.create_test_generation_session(
  run=run,
  columns=["col1", "col4"],
)
```

```python
run = dbnl.get_run(...)
dbnl.experimental.create_test_generation_session(
  run=run,
  columns=[
    {"name": "col1"},
    {"name": "col4"},
  ],
)
```

To generate tests for all columns, leave `columns` out:

```python
run = dbnl.run(...)
dbnl.experimental.create_test_generation_session(
  run=run,
)
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dbnl.com/v0.20.x/using-distributional/python-sdk/sdk-experimental-functions/create_test_generation_session.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
