# Code

The code repository can have two types of code files: regular Python scripts and transformations. For a transformation to be identified as such, a function called `transform` returning a LazyFrame (or DataFrame) needs to be present. The function will be called automatically when appropriate.

```python
import polars as pl

def transform(source_1, source_2):
    return source_1.join(source_2, on="id")
```

The `transform` function can have multiple parameters. A parameter to the `transform` function needs to have the same name as one of the transforms. By declaring a transform as a parameter, the dependency graph will be updated automatically, the transform will be read, and the DataFrame will be passed in as a parameter to the `transform` function.

The following example shows how a join transform declares a dependency on `source_1` and `source_2` by specifying those transform names as parameters for the `transform` function.

<figure><img src="/files/gXmGTFMmuFWXpme7LAUX" alt=""><figcaption></figcaption></figure>


---

# 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.dataspace.ch/platform/transformation/code.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.
