Created
August 9, 2017 14:40
-
-
Save schaeken/6bc9b2cd3b0150befe2956019f9832d9 to your computer and use it in GitHub Desktop.
Theme Store dashboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT COUNT(*) active_shops, | |
"theme name", | |
COALESCE(theme_dimension."current theme name", 'UNKNOWN') theme_name, | |
"current theme price", | |
"current theme state" | |
FROM partnerships.theme_publish_lookup | |
JOIN starscream.shop_dimension USING ("shop id") | |
LEFT JOIN support.theme_dimension | |
ON ("theme store id" = "theme id") | |
WHERE "current funnel state" = 'Active customer' | |
GROUP BY | |
"theme name", | |
theme_dimension."current theme name", | |
"current theme price", | |
"current theme state" | |
ORDER BY 1 DESC | |
LIMIT 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH distinct_shop_installs AS ( | |
SELECT DISTINCT "_shop_key", "_theme_key", "theme fulfilled at (est)" | |
FROM partnerships.theme_store_installation_facts | |
WHERE theme_store_installation_facts."theme fulfilled at (est)" >= DATEADD(MONTH, -3, GETDATE()) | |
) | |
SELECT DATE_TRUNC('week', distinct_shop_installs."theme fulfilled at (est)") AS "date", COUNT(*) AS "count", "current theme name" AS "theme name", "current theme support url" AS "support url", "current theme support style" AS "support style" | |
FROM distinct_shop_installs | |
JOIN support.theme_dimension ON (support.theme_dimension."_theme_key" = distinct_shop_installs."_theme_key") | |
WHERE "current theme state" = 'Published' | |
AND "support style" != 'Shopify' | |
GROUP BY "date", "current theme name", "current theme support style", "current theme support url" | |
ORDER BY 1 DESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH distinct_shop_installs AS ( | |
SELECT DISTINCT "_shop_key", "_theme_key" | |
FROM partnerships.theme_store_installation_facts | |
WHERE theme_store_installation_facts."theme fulfilled at (est)" >= DATEADD(MONTH, -3, GETDATE()) | |
) | |
SELECT COUNT(*) AS "count", "current theme name" AS "theme name", "current theme support style" AS "support style" | |
FROM distinct_shop_installs | |
JOIN support.theme_dimension ON (support.theme_dimension."_theme_key" = distinct_shop_installs."_theme_key") | |
WHERE "current theme state" = 'Published' | |
GROUP BY "current theme name", "current theme support style" | |
ORDER BY 1 DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment