Avoid table stage deploy when there are no queries (#5269)

This commit is contained in:
Ben Wu 2024-03-22 11:28:49 -04:00 коммит произвёл GitHub
Родитель 718dd0e391
Коммит 0bc2dd1cba
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 25 добавлений и 23 удалений

Просмотреть файл

@ -363,29 +363,30 @@ def _deploy_artifacts(ctx, artifact_files, project_id, dataset_suffix, sql_dir):
and "*" not in file.parent.name and file.parent.name != "INFORMATION_SCHEMA"
]
# checking and creating datasets needs to happen sequentially
for query_file in query_files:
dataset = query_file.parent.parent.name
create_dataset_if_not_exists(
project_id=project_id, dataset=dataset, suffix=dataset_suffix
)
if len(query_files) > 0:
# checking and creating datasets needs to happen sequentially
for query_file in query_files:
dataset = query_file.parent.parent.name
create_dataset_if_not_exists(
project_id=project_id, dataset=dataset, suffix=dataset_suffix
)
ctx.invoke(
update_query_schema,
name=query_files,
sql_dir=sql_dir,
project_id=project_id,
respect_dryrun_skip=True,
)
ctx.invoke(
deploy_query_schema,
name=query_files,
sql_dir=sql_dir,
project_id=project_id,
force=True,
respect_dryrun_skip=False,
skip_external_data=True,
)
ctx.invoke(
update_query_schema,
name=query_files,
sql_dir=sql_dir,
project_id=project_id,
respect_dryrun_skip=True,
)
ctx.invoke(
deploy_query_schema,
name=query_files,
sql_dir=sql_dir,
project_id=project_id,
force=True,
respect_dryrun_skip=False,
skip_external_data=True,
)
# deploy views
view_files = [

Просмотреть файл

@ -109,7 +109,8 @@ def paths_matching_name_pattern(
if pattern is None:
pattern = "*.*"
if isinstance(pattern, list):
# click nargs are passed in as a tuple
if isinstance(pattern, tuple) or isinstance(pattern, list):
for p in pattern:
matching_files += paths_matching_name_pattern(
str(p), sql_path, project_id, files, file_regex