Back to changelog

Per-column SQL in data models

You can now define individual columns on a table-based model using a SQL expression, right where you define other column metadata.

properties:
  name:
    name: Name
    type: String
    sql: "case when {is_internal} then concat('(INTERNAL) ', {name}) else name end"
  name_upper:
    name: Name (uppercase)
    type: String
    sql: "upper({name})"
    description: "The name column, but in uppercase"

Use {column_name} to reference another column, whether from the source table or computed under properties using sql.

You can also use these sql-defined properties in any operations on the same data model, including filters.

Read more in the docs.

Ready to get started?