Created
February 25, 2020 12:51
-
-
Save ZoranPandovski/6f735be1cc3d3f4dc3427799602072f3 to your computer and use it in GitHub Desktop.
PYPI downloads statistic from Google Big Query
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
| #MONTHLY PYPI PACKAGE DOWNLOADS | |
| SELECT | |
| COUNT(*) AS num_downloads, | |
| SUBSTR(_TABLE_SUFFIX, 1, 6) AS `day` | |
| FROM `the-psf.pypi.downloads*` | |
| WHERE | |
| file.project = 'mindsdb' | |
| -- Only query the last 6 months of history | |
| AND _TABLE_SUFFIX | |
| BETWEEN FORMAT_DATE( | |
| '%Y%m01', DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH)) | |
| AND FORMAT_DATE('%Y%m%d', CURRENT_DATE()) | |
| GROUP BY `day` | |
| ORDER BY `day` DESC | |
| #Filtered PYPI Downloads | |
| SELECT | |
| details.installer.name, | |
| COUNT(*) as donwload_count, | |
| FROM `the-psf.pypi.downloads*` | |
| WHERE | |
| file.project = 'mindsdb' | |
| AND _TABLE_SUFFIX | |
| BETWEEN FORMAT_DATE('%Y%m%d', DATE('2020-01-04')) | |
| AND FORMAT_DATE('%Y%m%d', DATE('2020-02-25')) | |
| GROUP BY details.installer.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment