From 6bb40cac4e67a26cc3c798b8afcaec77cb5c00de Mon Sep 17 00:00:00 2001 From: Eric Hilfer <575053+ehilfer@users.noreply.github.com> Date: Fri, 28 Jan 2022 05:18:29 -0500 Subject: [PATCH] fix: Skip over dropped columsn when filtering for text columns Check and skip if data_type is None. This can happen if a column has been dropped in Postgres. Fix #177 Co-authored-by: Eric Hilfer --- piicatcher/generators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piicatcher/generators.py b/piicatcher/generators.py index 72a3c8f..a20c930 100644 --- a/piicatcher/generators.py +++ b/piicatcher/generators.py @@ -115,7 +115,7 @@ def _filter_text_columns(column_list: List[CatColumn]) -> List[CatColumn]: matched_set = set() for regex in data_type_regex: matched_set |= set( - list(filter(lambda m: regex.search(m.data_type) is not None, column_list,)) + list(filter(lambda m: m.data_type is not None and regex.search(m.data_type) is not None, column_list)) ) LOGGER.debug(f"{len(matched_set)} text columns found")