How to choose the latest partition in BigQuery table?

后端 未结 7 934
暗喜
暗喜 2020-12-09 21:21

I am trying to select data from the latest partition in a date-partitioned BigQuery table, but the query still reads data from the whole table.

I\'ve tried (as far a

相关标签:
7条回答
  • 2020-12-09 22:10

    List all partitions with:

    #standardSQL
    SELECT
      _PARTITIONTIME as pt
    FROM
      `[DATASET].[TABLE]`
    GROUP BY 1
    

    And then choose the latest timestamp.

    Good luck :)

    https://cloud.google.com/bigquery/docs/querying-partitioned-tables

    0 讨论(0)
提交回复
热议问题