# Models

Preen models are defined as a YAML file. The model file is used to define the data sources, the query to be executed, and the type of query to be executed.

## Model Configuration Options

| Option          | Description                                                             | Required                 | Applicable Types                    |
| --------------- | ----------------------------------------------------------------------- | ------------------------ | ----------------------------------- |
| `name`          | The unique name of the model                                            | Yes                      | All                                 |
| `type`          | The type of the model (e.g.`database`, `file`)                          | Yes                      | All                                 |
| `format`        | The format of the data (e.g. csv)                                       | Only for `file` type     | `file`                              |
| `query`         | The query to be executed                                                | Yes for `database` type  | `database`                          |
| `options`       | Additional options for the model (e.g., file format, delimiter, header) | No                       | All (specific options vary by type) |
| `file_patterns` | The file patterns to be used for matching files                         | Only for `file` type     | `file`                              |
| `collection`    | The name of the collection to query                                     | Only for `database` type | Used for MongoDB sources            |

## Code References

* [models.go](https://github.com/hyphasql/hypha/blob/main/internal/engine/models.go)


---

# 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://preen.gitbook.io/preen-docs/documentation/config/models.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.
