Table Type
The Table type in AQL represents rows and columns returned from a model, where chained transformations keep returning Tables and aggregations produce a Scalar.
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:
ordersThis 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']) // <- tableHowever, 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 valueTruefalse
The truefalse field type in AQL represents boolean values (true or false), with the operators you can use to filter and compare truefalse dimensions in queries.
Dimension (reference)
AQL functions that require a predefined dimension field (model.field_name): why arbitrary expressions are rejected and how to define the right dimension in AML.