Unrecognized name: _PARTITIONTIME

Viewed 7557

I am trying to find the total number of partitions in a bigQuery partitioned table. I am using below query:

`SELECT
     _PARTITIONTIME AS pt, COUNT(1)
 FROM
     `dataset_name.table_name` 
 GROUP BY 1
 ORDER BY 1 DESC`

I took a break from Bigquery for almost 4 months, and I remember this query used to work earlier. Am I missing something?

2 Answers

As @ElliottBrossard mentioned in the comments, _PARTITIONTIME is a pseudo column available on partitioned tables only. If your table is not partitioned, the query will not work.

You can find more information regarding partitioned tables here.

This query works for me

Result

Please share your result and error if you need additional help

Related