# Union

Performs a SQL UNION or UNION ALL for the parent dataset, and another dataset. Operation will only merge columns with matching columns names in both datasets and drop all other columns. Column data type validation does not happen.

## Parameters

| Name        | Type    | Description                                                                                                                                 | Is Optional |
| ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| dataset2    | table   | Dataset to Union/Union All with main dataset                                                                                                |             |
| keep\_dupes | boolean | Set to True to performn a UNION ALL between the two tables, which keeps rows that are duplicated. Set to False to eliminate duplicate rows. | True        |

## Example

```python
d1 = rasgo.get.dataset(dataset_id)
d2 = rasgo.get.dataset(dataset_id_2)

ds2 = d1.transform.union(
    dataset2=d2,
    keep_dupes=True
)

ds2.preview()
```

## Source Code

{% embed url="<https://github.com/rasgointelligence/RasgoTransforms/blob/main/rasgotransforms/rasgotransforms/transforms/union/union.sql>" %}


---

# 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.rasgoml.com/rasgo-docs/rasgo-0.1/all-transforms/union.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.
