From 74539397a3779e4159f95f831becfc227a3ca74b Mon Sep 17 00:00:00 2001 From: Yasuhisa Yoshida Date: Thu, 2 Jan 2025 01:03:43 +0900 Subject: [PATCH] fmt --- dbterd/adapters/algos/base.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/dbterd/adapters/algos/base.py b/dbterd/adapters/algos/base.py index f5d739d..abfa385 100644 --- a/dbterd/adapters/algos/base.py +++ b/dbterd/adapters/algos/base.py @@ -475,18 +475,28 @@ def get_relationships(manifest: Manifest, **kwargs) -> List[Ref]: """ rule = get_algo_rule(**kwargs) refs = [] - for x in get_test_nodes_by_rule_name(manifest=manifest, rule_name=rule.get("name").lower()): + for x in get_test_nodes_by_rule_name( + manifest=manifest, rule_name=rule.get("name").lower() + ): node = manifest.nodes[x] kwargs = node.test_metadata.kwargs - to_column = str( - kwargs.get(rule.get("c_to")) - or "_and_".join(kwargs.get(f'{rule.get("c_to")}s', "unknown")) - ).replace('"', "").lower() - from_column = str( - kwargs.get("column_name") - or kwargs.get(rule.get("c_from")) - or "_and_".join(kwargs.get(f'{rule.get("c_from")}s', "unknown")) - ).replace('"', "").lower() + to_column = ( + str( + kwargs.get(rule.get("c_to")) + or "_and_".join(kwargs.get(f'{rule.get("c_to")}s', "unknown")) + ) + .replace('"', "") + .lower() + ) + from_column = ( + str( + kwargs.get("column_name") + or kwargs.get(rule.get("c_from")) + or "_and_".join(kwargs.get(f'{rule.get("c_from")}s', "unknown")) + ) + .replace('"', "") + .lower() + ) ref = Ref( name=x, table_map=get_table_map(test_node=node, **kwargs),