Logan
Logan

Reputation: 1371

Require Partition Filter On BigQuery Views

We have currently a couple of authorized views in the big query for various teams

Currently, we are using partition_date column to use in the query to reduce the amount of data processed (reference)

#standardSQL
SELECT
  <required_fields,...>, 
  EXTRACT(DATE FROM _PARTITIONTIME) AS partition_date
FROM
  `<project-name>.<dataset-name>.<table-name>`
WHERE
  _PARTITIONTIME >= TIMESTAMP("2018-05-01")
  AND _PARTITIONTIME <= CURRENT_TIMESTAMP()
  AND <Blah-Blah-Blah>

However, due to the number of users & data we have, it's very hard to maintain the quality of big query scripts leading us with increased query cost with the relatively increasing number of users.

I see we can use --require_partition_filter (reference) when creating TABLEs. So, could someone help me address the following questions

FYI, for someone who wants to update the current table with the above filter, I see we can use bq update command (reference) which I am planning to use for existing partitioned tables.

Upvotes: 1

Views: 3306

Answers (1)

Elliott Brossard
Elliott Brossard

Reputation: 33755

  1. Yes, the same restriction on the tables being queried through the view applies.
  2. There is not.

Upvotes: 3

Related Questions