Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fgeneral%2Fdataset.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fgeneral%2Fdataset.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `dataset`

## Description

Return the name of the **dataset** that a record originated from, such as `logs` or `spans`.

This is especially useful when a query combines records from more than one dataset — for example with [\`union\`](https://coralogix.com/docs/docs/dataprime/language-reference/commands-reference/union/.md) or [\`join\`](https://coralogix.com/docs/docs/dataprime/language-reference/commands-reference/join/.md) — and you need to know which dataset each record came from.

Note

To learn how datasets and dataspaces work, see [\`source\`](https://coralogix.com/docs/docs/dataprime/language-reference/commands-reference/sources/source/.md).

## Syntax

```
dataset(): string
```

## Example

**Use case: Tag each record with its source dataset**

Add the originating dataset name to every record so you can tell where it came from after combining data from multiple sources.

### Example data

```
{

    "service": "backend-service",

    "status_code": 500

}
```

### Example query

```
source logs

| limit 1

| create dataset from dataset()
```

### Example output

```
{

    "service": "backend-service",

    "status_code": 500,

    "dataset": "logs"

}
```
