Go back to Blog's hub Blog   |   tags:  

MAQL: Powerful Analytical Querying Made Simple

Written by Jan Kadlec  | 

MAQL: Powerful Analytical Querying Made Simple

If you are reading this you may know what MAQL is and want to know more or, alternatively, you may have never heard of MAQL but are keen to find out what it is. Either way, welcome and let me introduce you to MAQL.

What Is MAQL?

MAQL is GoodData's analytical querying language, which simplifies querying over multidimensional data and provides predefined functions that allow simple queries, such as simple aggregations, or more complex functions like skewness or kurtosis.

You’re probably thinking that the same thing can be done using SQL, and you would be right, but MAQL makes it significantly easier. When you are carrying out multidimensional analysis using SQL, you have to be careful about querying and joining your data. MAQL, on the other hand, uses a semantic model that allows you to omit many of these things, making querying much easier. With this in mind, let me first tell you what the semantic model is and why it is essential.

The Semantic Model

When a database is being modeled, the first thing which is done is a conceptual model. The conceptual model is there for database architects to understand the structure of the database. MAQL uses this knowledge as well and calls it a semantic model. The semantic model is the same as the conceptual model for database architects: It gives MAQL the power and knowledge of the database, its attributes, and relationships between tables. The inside is very crucial for efficient and user-friendly querying of data.

MAQL Syntax and Usage

MAQL syntax is similar to SQL syntax but with one main difference; MAQL does away with keywords like FROM and JOIN. Why? Due to the presence of the semantic model, they are simply not required: The semantic model has the knowledge of relations and the occurrence of attributes. Let's take a look at an example.

MAQL vs SQL process demonstration

As can be seen above, MAQL significantly simplifies the querying process. All we need to know with MAQL is what we want to do: The rest is up to the MAQL engine, which uses the semantic model to query our data. A MAQL query is called a metric; an aggregation producing a single number.

Another crucial advantage of MAQL is that you can specify the "ground truth analysis" (i.e., single source of truth) of your data by creating and storing metrics. Stored metrics can be reused in other metrics, as can be seen below.

MAQL metric composition

Another use for stored metrics is to provide results to other data consumers such as data analysts, data scientists, data engineers, and the relevant data consumption tools. The main idea can be seen in the picture below, where these tools access stored metrics using API, and all data consumers are using the same "ground truth analysis". This approach prevents the creation of duplicate analysis and simplifies work for data consumers.

MAQL as a part of Headless BI concept

Ready to Learn More?

MAQL forms part of the headless BI family, with headless BI providing consistent, real-time insights to an array of different data consumers. To try out MAQL and see it in action, simply pull the GoodData.CN docker image. For help and further info, see our MAQL documentation, step-by-step tutorials, community forum, and community slack channel. I think it is worth trying it on demo data which are included in the docker image or your own data or any data you can find. Get as creative as you like.

Written by Jan Kadlec  | 

Go back to Blog's hub Blog   |   tags:  

Subscribe to our newsletter

Get your dose of interesting facts on analytics in your inbox every month.