Pass the query's project to the dryrun cloud function (#4904)
So we don't have to rely on the dryrun cloud function using the `moz-fx-data-shared-prod` project by default.
This commit is contained in:
Родитель
13fc230fd4
Коммит
5ee7b8cdc7
|
@ -170,6 +170,7 @@ class DryRun:
|
|||
+ ")(?![a-zA-Z0-9_])"
|
||||
)
|
||||
sql = pattern.sub("@submission_date", sql)
|
||||
project = basename(dirname(dirname(dirname(self.sqlfile))))
|
||||
dataset = basename(dirname(dirname(self.sqlfile)))
|
||||
try:
|
||||
if self.use_cloud_function:
|
||||
|
@ -195,6 +196,7 @@ class DryRun:
|
|||
},
|
||||
data=json.dumps(
|
||||
{
|
||||
"project": project,
|
||||
"dataset": dataset,
|
||||
"query": sql,
|
||||
}
|
||||
|
@ -204,7 +206,6 @@ class DryRun:
|
|||
)
|
||||
return json.load(r)
|
||||
else:
|
||||
project = basename(dirname(dirname(dirname(self.sqlfile))))
|
||||
self.client.project = project
|
||||
job_config = bigquery.QueryJobConfig(
|
||||
dry_run=True,
|
||||
|
|
|
@ -55,7 +55,9 @@ def prod_schemas_uri():
|
|||
to read dataset labels, which contains the commit hash associated
|
||||
with the most recent production schemas deploy.
|
||||
"""
|
||||
dryrun = DryRun("telemetry_derived/foo/query.sql", content="SELECT 1")
|
||||
dryrun = DryRun(
|
||||
"moz-fx-data-shared-prod/telemetry_derived/foo/query.sql", content="SELECT 1"
|
||||
)
|
||||
build_id = dryrun.get_dataset_labels()["schemas_build_id"]
|
||||
commit_hash = build_id.split("_")[-1]
|
||||
mps_uri = ConfigLoader.get("schema", "mozilla_pipeline_schemas_uri")
|
||||
|
|
|
@ -7,7 +7,7 @@ from bigquery_etl.dryrun import DryRun, Errors
|
|||
|
||||
@pytest.fixture
|
||||
def tmp_query_path(tmp_path):
|
||||
p = tmp_path / "telemetry_derived" / "mytable"
|
||||
p = tmp_path / "moz-fx-data-shared-prod" / "telemetry_derived" / "mytable"
|
||||
p.mkdir(parents=True)
|
||||
return p
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче