Skip to main content

Table Type

info

This is part of our beta expression language AQL. Learn more. Request beta.

Knowledge Checkpoint

This documentation assumes you are somewhat familiar with the following concepts:

In AQL, a Table is an object that organizes data in the database in rows and columns. An AQL Table is similar to an SQL table, but it has extra properties that allow users to query and transform data flexibly.

A Table is the result of querying a Model

Suppose that you have defined an orders model in the AML layer:

Model orders {
dimension id {}
dimension status {}
dimension value {}
}

When writing AQL code, if you refer to the model orders:

orders

This expression will return a Table object that contains the fields as defined in the model, and all the order data in the database.

When you perform transformations like selection or filtering operations, you will also receive a Table object:

orders // <- a table
| select(orders.status, orders.user_id) // <- a table
| filter(orders.status in ['cancelled', 'finished']) // <- table

However, after aggregations, you may receive a Table or a Scalar value:

orders
| group(status)
| select(count: count(orders.id)) // <- a table with the column `count`

orders | count(orders.id) // <- a scalar value

Let us know what you think about this document :)