Best Python code snippet using dbt-osmosis_python
osmosis.py
Source:osmosis.py
...1031 extra_columns = [1032 x for x in yaml_columns if x.lower() not in (y.lower() for y in database_columns)1033 ]1034 return missing_columns, undocumented_columns, extra_columns1035 def propagate_documentation_downstream(self, force_inheritance: bool = False) -> None:1036 schema_map = self.build_schema_folder_mapping()1037 with self.adapter.connection_named("dbt-osmosis"):1038 for unique_id, node in track(list(self.filtered_models())):1039 logger().info("\n:point_right: Processing model: [bold]%s[/bold] \n", unique_id)1040 # Get schema file path, must exist to propagate documentation1041 schema_path: Optional[SchemaFileLocation] = schema_map.get(unique_id)1042 if schema_path is None or schema_path.current is None:1043 logger().info(1044 ":bow: No valid schema file found for model %s", unique_id1045 ) # We can't take action1046 continue1047 # Build Sets1048 database_columns: Set[str] = set(self.get_columns(node))1049 yaml_columns: Set[str] = set(column for column in node.columns)...
main.py
Source:main.py
...105 )106 # Conform project structure & bootstrap undocumented models injecting columns107 if runner.commit_project_restructure_to_disk():108 runner.safe_parse_project()109 runner.propagate_documentation_downstream(force_inheritance=force_inheritance)110@yaml.command(context_settings=CONTEXT)111@shared_opts112@click.option(113 "-f",114 "--fqn",115 type=click.STRING,116 help="Specify models based on FQN. Use dots as separators. Looks like folder.folder.model or folder.folder.source.table. Use list command to see the scope of an FQN filter.",117)118@click.option(119 "-d",120 "--dry-run",121 is_flag=True,122 help="If specified, no changes are committed to disk.",123)124def organize(125 target: Optional[str] = None,126 project_dir: Optional[str] = None,127 profiles_dir: Optional[str] = None,128 fqn: Optional[str] = None,129 dry_run: bool = False,130):131 """Organizes schema ymls based on config and injects undocumented models132 \f133 This command will conform schema ymls in your project as outlined in `dbt_project.yml` & bootstrap undocumented dbt models134 Args:135 target (Optional[str]): Profile target. Defaults to default target set in profile yml136 project_dir (Optional[str], optional): Dbt project directory. Defaults to current working directory.137 profiles_dir (Optional[str], optional): Dbt profile directory. Defaults to ~/.dbt138 """139 logger().info(":water_wave: Executing dbt-osmosis\n")140 runner = DbtYamlManager(141 project_dir=project_dir,142 profiles_dir=profiles_dir,143 target=target,144 fqn=fqn,145 dry_run=dry_run,146 )147 # Conform project structure & bootstrap undocumented models injecting columns148 runner.commit_project_restructure_to_disk()149@yaml.command(context_settings=CONTEXT)150@shared_opts151@click.option(152 "-f",153 "--fqn",154 type=click.STRING,155 help="Specify models based on FQN. Use dots as separators. Looks like folder.folder.model or folder.folder.source.table. Use list command to see the scope of an FQN filter.",156)157@click.option(158 "-F",159 "--force-inheritance",160 is_flag=True,161 help="If specified, forces documentation to be inherited overriding existing column level documentation where applicable.",162)163@click.option(164 "-d",165 "--dry-run",166 is_flag=True,167 help="If specified, no changes are committed to disk.",168)169def document(170 target: Optional[str] = None,171 project_dir: Optional[str] = None,172 profiles_dir: Optional[str] = None,173 fqn: Optional[str] = None,174 force_inheritance: bool = False,175 dry_run: bool = False,176):177 """Column level documentation inheritance for existing models178 \f179 This command will conform schema ymls in your project as outlined in `dbt_project.yml` & bootstrap undocumented dbt models180 Args:181 target (Optional[str]): Profile target. Defaults to default target set in profile yml182 project_dir (Optional[str], optional): Dbt project directory. Defaults to current working directory.183 profiles_dir (Optional[str], optional): Dbt profile directory. Defaults to ~/.dbt184 """185 logger().info(":water_wave: Executing dbt-osmosis\n")186 runner = DbtYamlManager(187 project_dir=project_dir,188 profiles_dir=profiles_dir,189 target=target,190 fqn=fqn,191 dry_run=dry_run,192 )193 # Propagate documentation & inject/remove schema file columns to align with model in database194 runner.propagate_documentation_downstream(force_inheritance)195class ServerRegisterThread(threading.Thread):196 """Thin container to capture errors in project registration"""197 def run(self):198 try:199 threading.Thread.run(self)200 except Exception as err:201 self.err = err202 pass203 else:204 self.err = None205def _health_check(host: str, port: int):206 """Performs health check on server,207 raises ConnectionError otherwise returns result"""208 t, max_t, i = 0.25, 10, 0...
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!!