Skip to content

Instantly share code, notes, and snippets.

@saurabh2590
Last active November 19, 2025 14:32
Show Gist options
  • Select an option

  • Save saurabh2590/865c594ba7a3fcdc5ff3afb6f6830bf0 to your computer and use it in GitHub Desktop.

Select an option

Save saurabh2590/865c594ba7a3fcdc5ff3afb6f6830bf0 to your computer and use it in GitHub Desktop.
Queries
-- Counting unique users who have atleast produced one event
SELECT
"system",
COUNT(DISTINCT user_id) AS nof_users
FROM "catalog-s3".bronze.mongodb.archiver.events
WHERE
"timestamp" >= '2024-08-01' AND
"timestamp" < '2025-08-01'
GROUP BY "system"
ORDER BY "system"
;
-- Counting unique students who have atleast finished one exerciseSeries
SELECT
sid,
COUNT(DISTINCT user_bid) AS nof_users
FROM "catalog-s3".silver."fact_exercise_series_finished"
WHERE
"ended_date_local" >= '2024-08-01' and
"ended_date_local" < '2025-08-01'
GROUP BY sid
ORDER BY sid
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment