Define a Query Execution Description through a YAML Resource
To configure a Query execution tool with a YAML resource, enter several YAML sections within the Description field as specified below.
| Section | Description |
|---|---|
description |
A one-line summary of what the resource is. |
guidance (optional) |
Free-form instructions that the competency receives once it has chosen the
resource. Examples:
|
grain |
The column or columns that identify a row. Each name in
When one attribute uniquely identifies a row: # Order — one row per order grain: [order_id] # Book — one row per title grain: [isbn] # Customer — one row per customer grain: [customer_id] When the identity is a combination of attributes: # OrderLine — one row per line within an order grain: [order, line_number] # Inventory — one row per (book, warehouse) pair grain: [book, warehouse] # Authorship — one row per (book, author) pair grain: [book, author] |
dimensions |
Columns on which the competency can group, filter, or sort by categories. For
both
You can add 2 more options:
Example: dimensions:
channel:
description: "Sales channel."
values:
- web
- mobile
- storefront
region:
description: "Customer region."
named_entity: true
|
fields |
Columns to display or filter on without grouping, such as identifiers, titles,
and amounts. See the description of the Example: fields:
order_id:
description: "Unique identifier (format: ORD-YYYY-NNNNN)."
pattern: "^ORD-\\d{4}-\\d{5}$"
placed_date:
description: "Date the order was placed (YYYY-MM-DD)."
time: true
pattern: "^\\d{4}-\\d{2}-\\d{2}$"
amount:
description: "Order total in EUR."
order_url:
description: "Link to the order in the tracking system."
url: true
|
predicates |
A predicate is a named filter rule. Instead of writing the rule out every time,
you give it a business-friendly name and the competency uses it. For example,
"paid", "shipped". You can write predicates without conditions. When you do not specify any condition, the competency treats the predicate name itself as a Boolean attribute. Use this when the data really does have a true/false attribute with that name. Example without conditions: predicates:
is_gift:
description: "Orders flagged as a gift."
You can write predicates with conditions. In that case, the competency evaluates
each condition row by row. Write it as if you were talking about one row:
You can use the following building blocks:
predicates:
is_paid:
description: "Orders that have been paid."
condition: status == "paid"
is_shipped:
description: "Orders that have been shipped."
condition: status IN ["shipped", "delivered"]
is_delivered:
description: "Orders that have reached the customer."
condition: status == "delivered"
is_unpaid:
description: "Orders that have not been paid."
condition: is_paid == false
is_literature:
description: "Genres considered literature."
condition: genre IN ["fiction", "poetry"]
is_future_delivery:
description: "Orders with a delivery date strictly after today."
condition: delivery_date > Date.today()
|
metrics |
Named measures (counts, sums, averages), such as a revenue or a conversion
rate. Declare each metric with 2 attributes:
Example: metrics:
revenue:
description: "Sum of order amount."
derived: "Order.sum(amount)"
conversion_rate:
description: "Paid orders divided by total orders."
derived: "Order.countIf(is_paid) / Order.count()"
|
references |
A link to another resource of the same toolset, such as the customer of an
order. Declare each reference with 2 attributes:
For a simple reference, the target resource must have a single-column grain. Example: references:
customer:
description: "Customer who placed the order."
target: Customer
Here each order points to one customer. The result set has a column named after
the reference ( A reference name can also appear in the grain: [book, warehouse]
references:
book:
description: "Book whose stock this row tracks."
target: Book
One row per |