Skip to content

Release Statistics

Craig Macdonald edited this page Sep 2, 2024 · 5 revisions

Head over to: https://console.cloud.google.com/bigquery

Use the following SQL:

#standardSQL
SELECT DATE(timestamp) d, COUNT(*) AS num_downloads
FROM `bigquery-public-data.pypi.file_downloads`
WHERE file.project = 'python-terrier'
  -- Only query the last 30 days of history
  AND DATE(timestamp)
    BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
    AND CURRENT_DATE()
  GROUP BY  d
  ORDER BY d

count by version and by date

SELECT DATE(timestamp) d, file.version v, COUNT(*) AS num_downloads
FROM `bigquery-public-data.pypi.file_downloads`
WHERE file.project = 'python-terrier'
  -- Only query the last 30 days of history
  AND DATE(timestamp)
    BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
    AND CURRENT_DATE()
  GROUP BY d, v
  ORDER BY d DESC, v

count by OS:

SELECT details.system.name v, COUNT(*) AS num_downloads
FROM `bigquery-public-data.pypi.file_downloads`
WHERE file.project = 'python-terrier'
  -- Only query the last 30 days of history
  AND DATE(timestamp)
    BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
    AND CURRENT_DATE()
  GROUP BY v
  ORDER BY v

count Python version in last 30 days:

SELECT REGEXP_EXTRACT(details.python, r'\d.\d.') v, COUNT(*) AS num_downloads
FROM `bigquery-public-data.pypi.file_downloads`
WHERE file.project = 'python-terrier'
  -- Only query the last 30 days of history
  AND DATE(timestamp)
    BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
    AND CURRENT_DATE()
  GROUP BY v
  ORDER BY v

countries

SELECT country_code v, COUNT(*) AS num_downloads
FROM `bigquery-public-data.pypi.file_downloads`
WHERE file.project = 'python-terrier'
  -- Only query the last 30 days of history
  AND DATE(timestamp)
    BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
    AND CURRENT_DATE()
  GROUP BY  v
  ORDER BY  num_downloads DESC
  
Clone this wiki locally