# Model schema

A SQL model is essentially constructed as a `SELECT` statement. The results generated from a model produce a table with columns, each having specific names and data types based on the transformations you define within the model.

You can define a model schema, which serves as a description of how the resulting data should be structured—similar to a table schema in a relational database.

Defining a schema for your model offers two primary benefits:

* **Description**: Team members can easily understand the expected structure of the data by reviewing the schema without having to run a preview.
* **Structural enforcement:** In the ReOrc data pipeline, other assets such as data tests or cubes refer directly to the model schema to understand the model's structure. This schema serves as the single definition of the structure, ensuring alignment across all implementations. Therefore, maintaining a consistent and well-defined schema is essential.

### Define a model schema

To define the schema for a SQL model, follow these steps:

1. Open a SQL model in the editor.
2. Switch to the **Fields** tab.
3. Generate the schema:

   For quick generation, you can click on **Generate Schema**. ReOrc will produce the schema results, including column names, data types, and suggested descriptions (generated by our AI).

   <figure><img src="/files/ofeAgJXVT8cP7CQP6gH0" alt=""><figcaption></figcaption></figure>
4. Verify and adjust the schema.

   After generation, you can rename fields (column names), modify data types, or adjust descriptions to improve clarity.

   <figure><img src="/files/QZkyL02eW0DqtORaOXD6" 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.reorc.com/data-modeling/models/model-schema.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.
