Beispiel #1
0
    def write_field(self,
                    field: PanoField,
                    *,
                    package: Optional[str] = None,
                    file_name: Optional[str] = None):
        """Write model to local filesystem."""
        if file_name is None:
            file_name = f'{field.slug}{FileExtension.FIELD_YAML.value}'

        package = package if package is not None else field.data_source
        if package is not None:
            # dataset-scope field
            path = Paths.fields_dir(self.cwd / package) / file_name
        else:
            # company-scope field
            path = Paths.fields_dir(self.cwd) / file_name

        logger.debug(f'About to write field {field.id}')
        write_yaml(path, field.to_dict())
Beispiel #2
0
 def write_scanned_field(self, field: PanoField):
     """"Write scanned field to local filesystem."""
     path = Paths.scanned_fields_dir(
     ) / f'{field.slug}{FileExtension.FIELD_YAML.value}'
     logger.debug(f'About to write field {field.slug}')
     write_yaml(path, field.to_dict())