Validated queries
Think of validated queries as training data or examples that Qluent uses with AI to better answer your questions.
Use case
In cases where Qluent struggles to answer a common question it can be fixed by adding a validated example, providing that you know the SQL code. Qluent is smart enough to adapt the given SQL code to different questions therefore it's not necessary to provide all variations. e.g. Query Can you give me the week over week growth for sessions for weeks 41-44?
and code
WITH weekly_sessions AS (
SELECT
DATE_PART('week', date) AS week,
SUM(sessions) AS total_sessions
FROM google_analytics_daily
WHERE DATE_PART('year', date) = 2024
AND DATE_PART('week', date) BETWEEN 40 AND 44
GROUP BY DATE_PART('week', date)
ORDER BY DATE_PART('week', date)
)
SELECT
week,
LAG(total_sessions) OVER (ORDER BY week) AS previous_week_sessions,
((total_sessions::DECIMAL - LAG(total_sessions) OVER (ORDER BY week)::DECIMAL)
/ NULLIF(LAG(total_sessions) OVER (ORDER BY week)::DECIMAL, 0)) * 100 AS week_over_week_growth
FROM weekly_sessions
WHERE week BETWEEN 41 AND 44