Revert "Add authorized views for payload_bytes raw and error"
This reverts commit 1d2fa74f9e
.
This commit is contained in:
Родитель
b61d84b678
Коммит
d1948fa445
|
@ -32,10 +32,6 @@ SKIP = {
|
|||
"sql/monitoring/document_sample_nonprod_v1/query.sql",
|
||||
"sql/monitoring/schema_error_counts_v1/view.sql",
|
||||
"sql/monitoring/structured_error_counts_v1/view.sql",
|
||||
"sql/monitoring/payload_bytes_error_structured/view.sql",
|
||||
"sql/monitoring/payload_bytes_error_telemetry/view.sql",
|
||||
"sql/monitoring/payload_bytes_raw_structured/view.sql",
|
||||
"sql/monitoring/payload_bytes_raw_telemetry/view.sql",
|
||||
"sql/telemetry/fxa_content_events_v1/query.sql",
|
||||
"sql/telemetry/fxa_auth_bounce_events_v1/query.sql",
|
||||
"sql/telemetry/fxa_auth_events_v1/query.sql",
|
||||
|
|
|
@ -9,8 +9,6 @@ import os
|
|||
from google.cloud import bigquery
|
||||
import sqlparse
|
||||
|
||||
VIEWS_TO_AUTHORIZE = ("sql/monitoring/payload_bytes_error_structured/view.sql",)
|
||||
|
||||
|
||||
def process_file(client, args, filepath):
|
||||
with open(filepath) as f:
|
||||
|
@ -32,25 +30,6 @@ def process_file(client, args, filepath):
|
|||
else:
|
||||
query_job.result()
|
||||
print(f"Published view {target_view}")
|
||||
# Authorize view if necessary; see
|
||||
# https://cloud.google.com/bigquery/docs/share-access-views
|
||||
if filepath in VIEWS_TO_AUTHORIZE:
|
||||
view = client.get_table(target_view.replace("`", ""))
|
||||
source_datasets = set(
|
||||
".".join([t.project, t.dataset_id])
|
||||
for t in query_job.referenced_tables
|
||||
)
|
||||
for d in source_datasets:
|
||||
source_dataset = client.get_dataset(d)
|
||||
access_entries = source_dataset.access_entries
|
||||
access_entries.append(
|
||||
bigquery.AccessEntry(None, "view", view.reference.to_api_repr())
|
||||
)
|
||||
source_dataset.access_entries = access_entries
|
||||
source_dataset = client.update_dataset(
|
||||
source_dataset, ["access_entries"]
|
||||
)
|
||||
print(f"Authorized view {target_view}")
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -68,14 +47,6 @@ def main():
|
|||
),
|
||||
)
|
||||
parser.add_argument("--log-level", default="INFO", help="Defaults to INFO")
|
||||
parser.add_argument(
|
||||
"--authorize",
|
||||
action="store_true",
|
||||
help=(
|
||||
"If enabled, process views that need authorization "
|
||||
"(requires admin privs on the source datasets)"
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--dry_run",
|
||||
"--dry-run",
|
||||
|
@ -96,9 +67,7 @@ def main():
|
|||
if os.path.isdir(target):
|
||||
for root, dirs, files in os.walk(target):
|
||||
if "view.sql" in files:
|
||||
filepath = os.path.join(root, "view.sql")
|
||||
if args.authorize or filepath not in VIEWS_TO_AUTHORIZE:
|
||||
process_file(client, args, filepath)
|
||||
process_file(client, args, os.path.join(root, "view.sql"))
|
||||
else:
|
||||
process_file(client, args, target)
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.monitoring.payload_bytes_error_structured`
|
||||
AS SELECT
|
||||
* EXCEPT (remote_addr, x_forwarded_for)
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_error.structured`
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.monitoring.payload_bytes_error_telemetry`
|
||||
AS SELECT
|
||||
* EXCEPT (remote_addr, x_forwarded_for)
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_error.telemetry`
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.monitoring.payload_bytes_raw_structured`
|
||||
AS SELECT
|
||||
* EXCEPT (remote_addr, x_forwarded_for)
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_raw.structured`
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.monitoring.payload_bytes_raw_telemetry`
|
||||
AS SELECT
|
||||
* EXCEPT (remote_addr, x_forwarded_for)
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_raw.telemetry`
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.monitoring.payload_bytes_error_structured`
|
||||
AS SELECT
|
||||
* EXCEPT (remote_addr, x_forwarded_for)
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_error.structured`
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.monitoring.payload_bytes_error_telemetry`
|
||||
AS SELECT
|
||||
* EXCEPT (remote_addr, x_forwarded_for)
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_error.telemetry`
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.monitoring.payload_bytes_raw_structured`
|
||||
AS SELECT
|
||||
* EXCEPT (remote_addr, x_forwarded_for)
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_raw.structured`
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.monitoring.payload_bytes_raw_telemetry`
|
||||
AS SELECT
|
||||
* EXCEPT (remote_addr, x_forwarded_for)
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.payload_bytes_raw.telemetry`
|
Загрузка…
Ссылка в новой задаче