Best Python code snippet using dbt-osmosis_python
osmosis.py
Source:osmosis.py  
...968                family_tree = self.build_node_ancestor_tree(969                    member, family_tree, members_found, depth + 1970                )971        return family_tree972    def inherit_column_level_knowledge(973        self,974        family_tree: Dict[str, Any],975    ) -> Dict[str, Dict[str, Any]]:976        """Inherit knowledge from ancestors in reverse insertion order to ensure that the most recent ancestor is always the one to inherit from"""977        knowledge: Dict[str, Dict[str, Any]] = {}978        for generation in reversed(family_tree):979            for ancestor in family_tree[generation]:980                member: ManifestNode = self.dbt.nodes.get(ancestor, self.dbt.sources.get(ancestor))981                if not member:982                    continue983                for name, info in member.columns.items():984                    knowledge.setdefault(name, {"progenitor": ancestor})985                    deserialized_info = info.to_dict()986                    # Handle Info:987                    # 1. tags are additive988                    # 2. descriptions are overriden989                    # 3. meta is merged990                    # 4. tests are ignored until I am convinced those shouldn't be hand curated with love991                    if deserialized_info["description"] in self.placeholders:992                        deserialized_info.pop("description", None)993                    deserialized_info["tags"] = list(994                        set(deserialized_info.pop("tags", []) + knowledge[name].get("tags", []))995                    )996                    if not deserialized_info["tags"]:997                        deserialized_info.pop("tags")  # poppin' tags like Macklemore998                    deserialized_info["meta"] = {999                        **knowledge[name].get("meta", {}),1000                        **deserialized_info["meta"],1001                    }1002                    if not deserialized_info["meta"]:1003                        deserialized_info.pop("meta")1004                    knowledge[name].update(deserialized_info)1005        return knowledge1006    def get_node_columns_with_inherited_knowledge(1007        self,1008        node: ManifestNode,1009    ) -> Dict[str, Dict[str, Any]]:1010        """Build a knowledgebase for the model based on iterating through ancestors"""1011        family_tree = self.build_node_ancestor_tree(node)1012        knowledge = self.inherit_column_level_knowledge(family_tree)1013        return knowledge1014    @staticmethod1015    def get_column_sets(1016        database_columns: Iterable[str],1017        yaml_columns: Iterable[str],1018        documented_columns: Iterable[str],1019    ) -> Tuple[List[str], List[str], List[str]]:1020        """Returns:1021        missing_columns: Columns in database not in dbt -- will be injected into schema file1022        undocumented_columns: Columns missing documentation -- descriptions will be inherited and injected into schema file where prior knowledge exists1023        extra_columns: Columns in schema file not in database -- will be removed from schema file1024        """1025        missing_columns = [1026            x for x in database_columns if x.lower() not in (y.lower() for y in yaml_columns)...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
