Skip to content

Commit 056adad

Browse files
committed
Add section on getting absolute URLs via BigQuery dataset
1 parent a256a50 commit 056adad

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

source/guides/analyzing-pypi-package-downloads.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,40 @@ query processes over 500 GB of data.
217217
| 3.5 | 1894153540 |
218218
+--------+---------------+
219219

220+
221+
Getting absolute links to artifacts
222+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223+
224+
It's sometimes helpful to be able to get the absolute links to download
225+
artifacts from PyPI based on their hashes, e.g. if a particular project or
226+
release has been deleted from PyPI. The metadata table includes the ``path``
227+
column, which includes the hash and artifact filename.
228+
229+
::
230+
231+
SELECT
232+
CONCAT('https://files.pythonhosted.org/packages', path) as url
233+
FROM
234+
`bigquery-public-data.pypi.distribution_metadata`
235+
WHERE
236+
filename LIKE 'sampleproject%'
237+
238+
239+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
240+
| url |
241+
+===================================================================================================================================================================+
242+
| https://files.pythonhosted.org/packages/eb/45/79be82bdeafcecb9dca474cad4003e32ef8e4a0dec6abbd4145ccb02abe1/sampleproject-1.2.0.tar.gz |
243+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
244+
| https://files.pythonhosted.org/packages/56/0a/178e8bbb585ec5b13af42dae48b1d7425d6575b3ff9b02e5ec475e38e1d6/sampleproject_nomura-1.2.0-py2.py3-none-any.whl |
245+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
246+
| https://files.pythonhosted.org/packages/63/88/3200eeaf22571f18d2c41e288862502e33365ccbdc12b892db23f51f8e70/sampleproject_nomura-1.2.0.tar.gz |
247+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
248+
| https://files.pythonhosted.org/packages/21/e9/2743311822e71c0756394b6c5ab15cb64ca66c78c6c6a5cd872c9ed33154/sampleproject_doubleyoung18-1.3.0-py2.py3-none-any.whl |
249+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
250+
| https://files.pythonhosted.org/packages/6f/5b/2f3fe94e1c02816fe23c7ceee5292fb186912929e1972eee7fb729fa27af/sampleproject-1.3.1.tar.gz |
251+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
252+
253+
220254
Caveats
221255
=======
222256

0 commit comments

Comments
 (0)