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.
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.
As can be seen in the 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.
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.
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 the 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.
Top comments (1)
Nice article!