Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unrecognized name: _PARTITIONTIME

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?

like image 597
Logical Avatar asked Dec 26 '18 06:12

Logical


People also ask

What is _partitiontime in BigQuery?

Ingestion-time partitioned tables contain a pseudo-column named _PARTITIONTIME , which is the partitioning column. The value of the column is the UTC ingestion time for each row, truncated to the partition boundary (such as hourly or daily), as a TIMESTAMP value.

How do I find the partition name in SQL Server?

You can use the sys. partitions system catalog view to return partition info for a table and most kinds of views. You can use the sys. dm_db_partition_stats system dynamic management view to return page and row-count information for every partition in the current database.

How do I select data from a partitioned table in SQL Server?

CREATE PARTITION FUNCTION CatsPartitionFunction (int) AS RANGE LEFT FOR VALUES (-1, 5, 100); This tells us how the data is stored, according to the values in the partitioning column. So we can now run a query that only returns data from a specific partition.


1 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.

like image 181
Teddy Avatar answered Oct 25 '22 22:10

Teddy