How to use inherit_column_level_knowledge method in dbt-osmosis

Best Python code snippet using dbt-osmosis_python

osmosis.py

Source: osmosis.py Github

copy

Full Screen

...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)...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

An Interactive Guide To CSS Hover Effects

Building a website is all about keeping the user experience in mind. Ultimately, it’s about providing visitors with a mind-blowing experience so they’ll keep coming back. One way to ensure visitors have a great time on your site is to add some eye-catching text or image animations.

Testing in Production: A Detailed Guide

When most firms employed a waterfall development model, it was widely joked about in the industry that Google kept its products in beta forever. Google has been a pioneer in making the case for in-production testing. Traditionally, before a build could go live, a tester was responsible for testing all scenarios, both defined and extempore, in a testing environment. However, this concept is evolving on multiple fronts today. For example, the tester is no longer testing alone. Developers, designers, build engineers, other stakeholders, and end users, both inside and outside the product team, are testing the product and providing feedback.

Developers and Bugs – why are they happening again and again?

Entering the world of testers, one question started to formulate in my mind: “what is the reason that bugs happen?”.

A Complete Guide To CSS Container Queries

In 2007, Steve Jobs launched the first iPhone, which revolutionized the world. But because of that, many businesses dealt with the problem of changing the layout of websites from desktop to mobile by delivering completely different mobile-compatible websites under the subdomain of ‘m’ (e.g., https://m.facebook.com). And we were all trying to figure out how to work in this new world of contending with mobile and desktop screen sizes.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run dbt-osmosis automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful