Created
June 15, 2024 06:13
-
-
Save ringsaturn/bfe234443d6cff998227f087d4b685a5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
distribution | downloads_period1 | downloads_period2 | change_in_downloads | |
---|---|---|---|---|
Amazon Linux | 768 | 61010 | 60242 | |
Debian GNU/Linux | 4400 | 41935 | 37535 | |
macOS | 116 | 121 | 5 | |
Arch Linux | 8 | 10 | 2 | |
Alpine Linux | 2 | 3 | 1 | |
AlmaLinux | 2 | 2 | 0 | |
openSUSE Tumbleweed | 1 | 0 | -1 | |
Rocky Linux | 6 | 5 | -1 | |
SLES | 1 | 0 | -1 | |
Kali GNU/Linux | 1 | 0 | -1 | |
Fedora Linux | 2 | 0 | -2 | |
KDE neon | 2 | 0 | -2 | |
EndeavourOS | 2 | 0 | -2 | |
Raspbian GNU/Linux | 5 | 3 | -2 | |
CentOS Linux | 3 | 0 | -3 | |
Manjaro Linux | 9 | 6 | -3 | |
Linux Mint | 5 | 1 | -4 | |
Ubuntu | 32942 | 28710 | -4232 |
This file contains hidden or 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
#standardSQL | |
WITH Period1 AS ( | |
SELECT | |
details.distro.name AS distribution, | |
COUNT(*) AS downloads_period1 | |
FROM | |
`bigquery-public-data.pypi.file_downloads` | |
WHERE | |
file.project = 'tzfpy' | |
AND DATE(timestamp) BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY) AND DATE_SUB(CURRENT_DATE(), INTERVAL 15 DAY) | |
AND details.distro.name IS NOT NULL | |
GROUP BY | |
distribution | |
), | |
Period2 AS ( | |
SELECT | |
details.distro.name AS distribution, | |
COUNT(*) AS downloads_period2 | |
FROM | |
`bigquery-public-data.pypi.file_downloads` | |
WHERE | |
file.project = 'tzfpy' | |
AND DATE(timestamp) BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 14 DAY) AND CURRENT_DATE() | |
AND details.distro.name IS NOT NULL | |
GROUP BY | |
distribution | |
) | |
SELECT | |
p1.distribution, | |
p1.downloads_period1, | |
IFNULL(p2.downloads_period2, 0) AS downloads_period2, | |
IFNULL(p2.downloads_period2, 0) - p1.downloads_period1 AS change_in_downloads | |
FROM | |
Period1 p1 | |
LEFT JOIN | |
Period2 p2 | |
ON | |
p1.distribution = p2.distribution | |
ORDER BY | |
change_in_downloads DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment