Generate CSVs

class linkml.generators.csvgen.CsvGenerator(schema: str | ~typing.TextIO | ~linkml_runtime.linkml_model.meta.SchemaDefinition | ~linkml.utils.generator.Generator | ~pathlib.Path, schemaview: ~linkml_runtime.utils.schemaview.SchemaView | None = None, format: str | None = None, metadata: bool = True, useuris: bool | None = None, log_level: int | None = 30, mergeimports: bool | None = True, source_file_date: str | None = None, source_file_size: int | None = None, logger: ~logging.Logger | None = None, verbose: bool | None = None, output: str | None = None, namespaces: ~linkml_runtime.utils.namespaces.Namespaces | None = None, directory_output: bool = False, base_dir: str | None = None, metamodel_name_map: ~typing.Dict[str, str] | None = None, importmap: str | ~typing.Mapping[str, str] | None = None, emit_prefixes: ~typing.Set[str] = <factory>, metamodel: ~linkml.utils.schemaloader.SchemaLoader | None = None, stacktrace: bool = False, sep: str | None = None, closure: ~typing.Set[~linkml_runtime.linkml_model.meta.ClassDefinitionName] | None = None, writer: ~csv.DictWriter | None = None, _str_io: ~_io.StringIO | None = None, **_kwargs)[source]#

Generates CSV summaries

Note: this generator is not widely used, and has largely been supplanted by schemasheets

closure: Set[ClassDefinitionName] | None = None#

List of classes to include in output

end_schema(**kwargs) str[source]#

Visited once at the end of generation

@param kwargs: Arguments passed through from CLI – implementation dependent

generate_header() str[source]#
generatorname: ClassVar[str] = 'csvgen.py'#

Name of the generator. Override with os.path.basename(__file__)

generatorversion: ClassVar[str] = '0.1.1'#

Version of the generator. Consider deprecating and instead use overall linkml version

requires_metamodel: ClassVar[bool] = False#

Generator queries an instance of the metamodel

sep: str | None = None#

Separator for columns

uses_schemaloader: ClassVar[bool] = True#

Old-style generator that uses the SchemaLoader and visitor pattern

valid_formats: ClassVar[List[str]] = ['csv', 'tsv']#

Allowed formats - first format is default

visit_class(cls: ClassDefinition) bool[source]#

Visited once per schema class

@param cls: class being visited @return: Visit slots and end class. False means skip and go on

visit_schema(classes: List[ClassDefinitionName] | None = None, **_) None[source]#

Visited once at the beginning of generation

@param kwargs: Arguments passed through from CLI – implementation dependent

writer: DictWriter | None = None#

Python dictwriter