PyYaml dryrun
This commit is contained in:
Родитель
ac6344045a
Коммит
c2b56907fb
|
@ -42,7 +42,9 @@ jobs:
|
|||
- checkout
|
||||
- run:
|
||||
name: Verify that BigQuery validates each query
|
||||
command: script/dryrun
|
||||
command: |
|
||||
pip install PyYaml
|
||||
script/dryrun
|
||||
deploy:
|
||||
parameters:
|
||||
image:
|
||||
|
|
|
@ -76,7 +76,7 @@ class Metadata:
|
|||
|
||||
@classmethod
|
||||
def of_sql_file(cls, sql_file):
|
||||
"""Returns the metadata that is associated with the provided SQL file."""
|
||||
"""Return the metadata that is associated with the provided SQL file."""
|
||||
path, _ = os.path.split(sql_file)
|
||||
metadata_file = os.path.join(path, METADATA_FILE)
|
||||
cls = Metadata.from_file(metadata_file)
|
||||
|
|
|
@ -97,8 +97,6 @@ USE_DERIVED_DATASETS = {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
def worker_entrypoint(public_project, sqlfile):
|
||||
sql = open(sqlfile).read()
|
||||
if sqlfile in USE_DERIVED_DATASETS:
|
||||
|
@ -114,7 +112,7 @@ def worker_entrypoint(public_project, sqlfile):
|
|||
metadata = Metadata.of_sql_file(sqlfile)
|
||||
if metadata.is_public_bigquery():
|
||||
request_data["project"] = public_project
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# for all other queries perform dryrun in default project
|
||||
pass
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ parser.add_argument(
|
|||
|
||||
def is_public_bigquery(metadata_file):
|
||||
"""
|
||||
Reads the metadata file associated with the query to determine if the query
|
||||
Reads the metadata file associated with the query to determine if the query
|
||||
results should be written into the public dataset.
|
||||
"""
|
||||
|
||||
|
@ -69,7 +69,7 @@ def generate_and_publish_view(client, project, dataset, table, public_project, d
|
|||
full_view_id = ".".join([project, dataset, table])
|
||||
public_table = ".".join([public_project, dataset, table])
|
||||
|
||||
view_sql = f"""CREATE OR REPLACE VIEW
|
||||
view_sql = f"""CREATE OR REPLACE VIEW
|
||||
`{full_view_id}`
|
||||
AS SELECT * FROM `{public_table}`
|
||||
"""
|
||||
|
|
Загрузка…
Ссылка в новой задаче