1
votes

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

  • When I create a table with the above filter, does the referenced view will also expect the partition condition because of the partition filter enabled on the table level?
  • Due to the number of authorized views connected to tables we have, it requires significant efforts to change it to materialized views (tables). Is there an alternative way possible to apply something similar/use like --require_partition_filter on view level?

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.

1

1 Answers

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