Model schema
Last updated
Last updated
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 Recurve 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.
To define the schema for a SQL model, follow these steps:
Open a SQL model in the editor.
Switch to the Fields tab.
Generate the schema:
For quick generation, you can click on Generate Schema. Recurve will produce the schema results, including column names, data types, and suggested descriptions (generated by our AI).
Verify and adjust the schema.
After generation, you can rename fields (column names), modify data types, or adjust descriptions to improve clarity.