Malloy Documentation

Malloy is an experimental language for describing data relationships and transformations. It is an analytical language that runs on SQL databases. It provides the ability to define a semantic data model and query it. Malloy currently works with SQL databases BigQuery, Postgres, and querying Parquet and CSV via DuckDB.

  • Queries compile to SQL, optimized for your database.

  • Has both a semantic data model and a query language. The semantic model contains reusable calculations and definitions, making queries short and readable.

  • Excels at reading and writing nested data sets.

  • Things that are complicated in SQL are simple to express in Malloy. For example: level of detail calculations, percent of total, aggregating against multiple tables across a join safely, date operations, reasonable ordering by default, and more.

Malloy is a work in progress. Malloy is designed to be a language for anyone who works with SQL--whether you’re an analyst, data scientist, data engineer, or someone building a data application. If you know SQL, Malloy will feel familiar, while more powerful and efficient. Malloy allows you to model as you go, so there is no heavy up-front work before you can start answering complex questions, and you're never held back or restricted by the model.

Try Malloy Today

Get Involved

The Story of Malloy

Malloy was designed by a team of people with a lot of experience in understanding the task of extracting meaning from data. Years of constant exposure to SQL resulted in a tremendous sense of wonder at the power of SQL ... and a tremendous source of frustration at how bad SQL is at representing the types of operations needed to get meaningful data out of relational databases, and how difficult it is to maintain and extend a complex set of transformations written in SQL.

Malloy started as a "clean slate" thought experiment, if we knew all the things we know about data, and about programming with data, and about programming languages in general, and we were designing a query language today, what would it look like.

In it's earliest form, Malloy looked a lot like SQL, and much of Malloy continues to be influenced by the overall design of the SQL language. It was always the intention that there could be a document that would contain both Malloy and SQL and those would make sense together, perhaps parallel to the way Javascript and Typescript work together.