Use SQL views as input tables
Shape your source data into a single, analysis-ready entity table (often via a SQL view) before configuring Syntho.
Last updated
Was this helpful?
Was this helpful?
CREATE OR REPLACE VIEW syntho_customer_entity_v AS
SELECT
c.customer_id,
c.country_code,
c.segment,
c.signup_date,
o.order_date AS last_order_date,
o.order_total AS last_order_total
FROM customers c
LEFT JOIN LATERAL (
SELECT order_date, order_total
FROM orders o
WHERE o.customer_id = c.customer_id
ORDER BY order_date DESC
LIMIT 1
) o ON true;