Last active
August 28, 2020 14:35
-
-
Save matthew-brett/e3901b344b8d81f5633908347b1b333e to your computer and use it in GitHub Desktop.
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 pip_version, distro_name, distro_version, libc_version, (download_count / total * 100) as percent | |
from ( | |
SELECT REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(LOWER(details.distro.name), " (gnu/)?linux", ""), "^red.?hat.*", "redhat"), "os x","macos") AS distro_name, | |
details.distro.version as distro_version, | |
details.distro.libc.version as libc_version, | |
details.installer.version as pip_version, | |
COUNT(*) AS download_count, | |
SUM(COUNT(*)) OVER () AS total | |
FROM `the-psf.pypi.downloads*` | |
WHERE | |
details.installer.version IS NOT NULL | |
AND details.distro.name IS NOT NULL | |
AND details.distro.libc.version IS NOT NULL | |
AND REGEXP_CONTAINS(file.filename, '^.*-manylinux.*_x86_64.whl$') | |
-- Only query the last 30 days of history | |
AND _TABLE_SUFFIX | |
BETWEEN FORMAT_DATE( | |
'%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)) | |
AND FORMAT_DATE('%Y%m%d', CURRENT_DATE()) | |
GROUP BY | |
pip_version, distro_name, distro_version, libc_version | |
ORDER BY | |
download_count, pip_version DESC | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment