Prototyping

Feature definitions are evaluated lazily. It means that if you don't use a feature in the SELECT clause, it will not be evaluated. It is convenient for prototyping, as what you put in the SELECT governs what is evaluated.

Using the exact same query with customer outputs, you can see that the query is evaluated for the customers 100, 101 and 102.

FeatureQL
WITH
    -- Related to the customer
    CUSTOMER_NAME := TABLES.DIM_CUSTOMERS[name],
  	NUM_ORDERS_RELATED := RELATED(SUM(IF(ORDER_DATE>TIMESTAMP '2025-01-01', 1, 0)) GROUP BY TABLES.FCT_ORDERS[order_customer_id] VIA CUSTOMER_ID),
    -- Related to the order
    ORDER_DATE := TABLES.FCT_ORDERS[time_create]
SELECT
    -- Related to the customer
    CUSTOMER_ID,
  	NUM_ORDERS_RELATED,
    -- Related to the order
    -- ORDER_ID,
  	-- ORDER_DATE
FROM FM.ECOMM
FOR
    CUSTOMER_ID := BIND_VALUES(SEQUENCE(100,102)),
    ORDER_ID := BIND_VALUES(SEQUENCE(200,203)),
;
Result
FM.ECOMM.CUSTOMER_ID BIGINTNUM_ORDERS_RELATED VARCHAR
1002
1010
1021

Using the exact same query with order outputs, you can see that the query is evaluated for the orders 200, 201, 202 and 203.

FeatureQL
WITH
    -- Related to the customer
    CUSTOMER_NAME := TABLES.DIM_CUSTOMERS[name],
  	NUM_ORDERS_RELATED := RELATED(SUM(IF(ORDER_DATE>TIMESTAMP '2025-01-01', 1, 0)) GROUP BY TABLES.FCT_ORDERS[order_customer_id] VIA CUSTOMER_ID),
    -- Related to the order
    ORDER_DATE := TABLES.FCT_ORDERS[time_create]
SELECT
    -- Related to the customer
    -- CUSTOMER_ID,
  	-- NUM_ORDERS_RELATED,
    -- Related to the order
    ORDER_ID,
  	ORDER_DATE
FROM FM.ECOMM
FOR
    CUSTOMER_ID := BIND_VALUES(SEQUENCE(100,102)),
    ORDER_ID := BIND_VALUES(SEQUENCE(200,203)),
;
Result
FM.ECOMM.ORDER_ID BIGINTORDER_DATE VARCHAR
2002025-09-18T14:30:00
2012024-12-08T09:45:00
2022025-02-03T12:00:02
2032025-09-18T14:30:00

Once you are happy with your query, we recommend you to clean the definitions to keep only the features needed for clarity.

Note: Be careful, if you use the exact same query with customer outputs and order outputs, it will perform a cross-join between the customers and the orders, which is likely not what you want.

Last update at: 2026/02/16 15:46:17
Last updated: 2026-02-16 15:46:51