Skip to content

Commit

Permalink
safeguard boolean checks
Browse files Browse the repository at this point in the history
otherwise exception is thrown during parsing.e.g. list index out of range
  • Loading branch information
mayurinehate committed Jul 29, 2024
1 parent 4f36f40 commit 12fea30
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,24 @@ def local_temp_path(self) -> pathlib.Path:
return path

def is_temp_table(self, name: str) -> bool:
return BigqueryTableIdentifier.from_string_name(name).dataset.startswith(
self.config.temp_table_dataset_prefix
)
try:
return BigqueryTableIdentifier.from_string_name(name).dataset.startswith(
self.config.temp_table_dataset_prefix
)
except Exception:
logger.warning(f"Error parsing table name {name} ")
return False

def is_allowed_table(self, name: str) -> bool:
table_id = BigqueryTableIdentifier.from_string_name(name)
if self.discovered_tables and str(table_id) not in self.discovered_tables:
try:
table_id = BigqueryTableIdentifier.from_string_name(name)
if self.discovered_tables and str(table_id) not in self.discovered_tables:
return False
return self.filters.is_allowed(table_id)
except Exception:
logger.warning(f"Error parsing table name {name} ")
return False

return self.filters.is_allowed(table_id)

def get_workunits_internal(
self,
) -> Iterable[MetadataWorkUnit]:
Expand Down

0 comments on commit 12fea30

Please sign in to comment.