import re


def _get_join_tables_and_columns(clause):
    """Parses a join clause like `<t1>.<c1>=<t2>.<c2>` into tables and columns."""
    pattern = re.compile(r"^(.*)\.(.*?)\s*=\s*(.*)\.(.*)$")
    match = pattern.match(clause)
    assert match, clause
    return match.group(1), match.group(2), match.group(3), match.group(4)