> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morph-data.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Alias

Aliases are a mechanism for assigning identifiers to Python functions, SQL queries, etc. throughout the Morph framework so that they can be easily referenced from other files.

Using aliases, you can combine functions and queries spread across multiple files, build data pipelines, and reference data from a front-end built with markdown.

<Frame>
  <img src="https://mintcdn.com/queue-4c50ebb3/evgQaQjX53Vch8Y5/assets/images/docs/alias-overview.png?fit=max&auto=format&n=evgQaQjX53Vch8Y5&q=85&s=fb0bb1fc5a8878699655374aa40b4c01" alt="alias overview" width="2432" height="1190" data-path="assets/images/docs/alias-overview.png" />
</Frame>

## Setting up Aliases

### Setting up an Alias for a Python Function

To set up an alias for a Python function, use the `@morph.func(name="alias")` decorator.

```python dataframe.py theme={"dark"}
import morph
from morph import MorphGlobalContext

@morph.func(name="example_dataframe") # Set up alias
def main(context: MorphGlobalContext):
    ...
    return df
```

If the name is not specified, the function name will be used as the alias.

```python theme={"dark"}
@morph.func # If no alias is set, the function name will be used as the alias
def example_dataframe(context: MorphGlobalContext):
    ...
    return df
```

### Setting up an Alias for an SQL Query

To set up an alias for an SQL query, use `config(name="alias")`.

```sql get_users.sql theme={"dark"}
{{
    config(
        name="example_data" # Set up alias
    )
}}

select * from {{load_data("get_users")}};
```

## Referencing Data Using Aliases

### Referencing Data in Python

To reference data using an alias in a Python function, use the `@morph.load_data("alias")` decorator.

```python load.py theme={"dark"}
import morph
from morph import MorphGlobalContext

@morph.func
@morph.load_data("example_data") # Load data using alias
def example_dataframe(context: MorphGlobalContext):
    df = context.data["example_data"]
    return df
```

### Referencing Data in Markdown

When using data-referencing components such as `<DataTable>` or `<Embed>`, specify the alias to reference the data.

```md index.mdx theme={"dark"}
# Data Table

Specify the alias to reference the data as follows.

<DataTable loadData="example_dataframe" />
```
