> On May 22, 2016, at 3:39 AM, Wes Turner <[email protected]> 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



_______________________________________________
Distutils-SIG maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to