Skip to content

Commit

Permalink
clarify vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ADBond committed Mar 12, 2024
1 parent 1ac70d3 commit d3d9638
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions splink/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "

Expand Down
2 changes: 1 addition & 1 deletion splink/sql_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d3d9638

Please sign in to comment.