#enigmagi-sigma

1 messages · Page 1 of 1 (latest)

astral templeBOT
keen canopy
#

enigmagi-sigma

mellow plinth
#

I use it a lot @violet locust.

violet locust
#

that's awesome.

#

would you be interested in trying out an AI slackbot that will generate the queries from natural language?
example:
you type in "how many customers did we churn this month?" and get

WITH customer_month AS (
  SELECT DISTINCT customer_id, DATE_TRUNC('month', created) as month
  FROM charges
  WHERE customer_id IS NOT NULL
    AND captured
),
customer_retention AS (
  SELECT
    customer_id,
    month,
    CASE
      WHEN month + INTERVAL '1' MONTH = LEAD(month) OVER(PARTITION BY customer_id ORDER BY month) THEN true
      ELSE false
    END AS retained
  FROM customer_month
)
SELECT
  COUNT(customer_id) AS churned_customers
FROM customer_retention
WHERE month = DATE_TRUNC('month', NOW() - INTERVAL '1' MONTH)
AND NOT retained
mellow plinth
#

I personally probably wouldn't use it, but it does seem like it could be valuable for some that aren't as familiar with the data model/SQL/Sigma.