How to use get_osmosis_config method in dbt-osmosis

Best Python code snippet using dbt-osmosis_python

osmosis.py

Source:osmosis.py Github

copy

Full Screen

...700 subset.items() if subset else chain(self.dbt.nodes.items(), self.dbt.sources.items())701 ):702 if self._filter_model(dbt_node):703 yield unique_id, dbt_node704 def get_osmosis_config(self, node: ManifestNode) -> Optional[SchemaFileOrganizationPattern]:705 """Validates a config string. If input is a source, we return the resource type str instead"""706 if node.resource_type == NodeType.Source:707 return None708 osmosis_config = node.config.get("dbt-osmosis")709 if not osmosis_config:710 raise MissingOsmosisConfig(711 f"Config not set for model {node.name}, we recommend setting the config at a directory level through the `dbt_project.yml`"712 )713 try:714 return SchemaFileOrganizationPattern(osmosis_config)715 except ValueError as exc:716 raise InvalidOsmosisConfig(717 f"Invalid config for model {node.name}: {osmosis_config}"718 ) from exc719 def get_schema_path(self, node: ManifestNode) -> Optional[Path]:720 """Resolve absolute schema file path for a manifest node"""721 schema_path = None722 if node.resource_type == NodeType.Model and node.patch_path:723 schema_path: str = node.patch_path.partition("://")[-1]724 elif node.resource_type == NodeType.Source:725 if hasattr(node, "source_name"):726 schema_path: str = node.path727 if schema_path:728 return Path(self.project_root).joinpath(schema_path)729 def get_target_schema_path(self, node: ManifestNode) -> Path:730 """Resolve the correct schema yml target based on the dbt-osmosis config for the model / directory"""731 osmosis_config = self.get_osmosis_config(node)732 if not osmosis_config:733 return Path(node.root_path, node.original_file_path)734 # Here we resolve file migration targets based on the config735 if osmosis_config == SchemaFileOrganizationPattern.SchemaYaml:736 schema = "schema"737 elif osmosis_config == SchemaFileOrganizationPattern.FolderYaml:738 schema = node.fqn[-2]739 elif osmosis_config == SchemaFileOrganizationPattern.ModelYaml:740 schema = node.name741 elif osmosis_config == SchemaFileOrganizationPattern.SchemaModelYaml:742 schema = "schema/" + node.name743 elif osmosis_config == SchemaFileOrganizationPattern.UnderscoreModelYaml:744 schema = "_" + node.name745 else:...

Full Screen

Full Screen

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