From d3d96380ab79bc18c185debf0eaae1165cb0968e Mon Sep 17 00:00:00 2001 From: ADBond <48208438+ADBond@users.noreply.github.com> Date: Tue, 12 Mar 2024 15:10:34 +0000 Subject: [PATCH] clarify vars --- splink/accuracy.py | 8 ++++---- splink/sql_transform.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/splink/accuracy.py b/splink/accuracy.py index 22db920812..7b4ffac6a2 100644 --- a/splink/accuracy.py +++ b/splink/accuracy.py @@ -151,10 +151,10 @@ def _select_found_by_blocking_rules(linker: "Linker"): brs = linker._settings_obj._blocking_rules_to_generate_predictions if brs: - brs = [move_l_r_table_prefix_to_column_suffix(b.blocking_rule_sql) for b in brs] - brs = [f"(coalesce({b}, false))" for b in brs] - brs = " OR ".join(brs) - br_col = f" ({brs}) " + br_strings = [move_l_r_table_prefix_to_column_suffix(b.blocking_rule_sql) for b in brs] + wrapped_br_strings = [f"(coalesce({b}, false))" for b in br_strings] + full_br_string = " OR ".join(wrapped_br_strings) + br_col = f" ({full_br_string}) " else: br_col = " 1=1 " diff --git a/splink/sql_transform.py b/splink/sql_transform.py index 14bd6ef638..8e4a7eee09 100644 --- a/splink/sql_transform.py +++ b/splink/sql_transform.py @@ -34,7 +34,7 @@ def _remove_table_prefix(node): return node -def move_l_r_table_prefix_to_column_suffix(blocking_rule): +def move_l_r_table_prefix_to_column_suffix(blocking_rule) -> str: expression_tree = sqlglot.parse_one(blocking_rule, read=None) transformed_tree = expression_tree.transform(_add_l_or_r_to_identifier) transformed_tree = transformed_tree.transform(_remove_table_prefix)