Site icon Therma blind

Querying all partition table

I have around 600 partitioned tables called table.ga_session. Each table is separated by 1 day, and for each table it has its own unique name, for example, table for date (30/12/2021) has its name as table.ga_session_20211230. The same goes for other table, the naming format would be like this table.ga_session_YYYYMMDD.

Now, when I try to call all partitioned table, I cannot use command like this:. The error showed that _PARTITIONTIME is unrecognized.

SELECT 
*,
_PARTITIONTIME pt

FROM `table.ga_sessions_20211228` 

where _PARTITIONTIME 

BETWEEN TIMESTAMP('2019-01-01') 

AND TIMESTAMP('2020-01-02')

I also cannot use FROM ‘table.ga_sessions’ to apply WHERE clause to take out range of time as the table does not exist. How do I call all of these partitioned table?

Exit mobile version