[Distutils] Publicly Queryable Statistics

Donald Stufft donald at stufft.io
Sun May 22 10:23:39 EDT 2016


> On May 22, 2016, at 3:39 AM, Wes Turner <wes.turner at gmail.com> wrote:
> 
> - to query, say, a month's worth of data, what would need to be done?
> - "sharded by day" ... UTC?
> 


You use a TABLE_DATE_RANGE() function, like this:


    TABLE_DATE_RANGE([the-psf:pypi.downloads], TIMESTAMP("20160114"), TIMESTAMP("20160214”))

Or, if you wanted to get fancier you could do something like this for the “last 30 days”:

    TABLE_DATE_RANGE([the-psf:pypi.downloads], DATE_ADD(CURRENT_TIMESTAMP(), -1, "month"), CURRENT_TIMESTAMP())


You can see examples of it in use at https://gist.github.com/alex/4f100a9592b05e9b4d63 <https://gist.github.com/alex/4f100a9592b05e9b4d63> or see the query docs at https://cloud.google.com/bigquery/query-reference.


—
Donald Stufft



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20160522/5d3a7c9d/attachment.html>


More information about the Distutils-SIG mailing list