SnowDDL
Search
K
🟠

Parsers

Parsers are used to process YAML config files into blueprints, one parser per object type.
All standard parsers are located in /parser/ directory.

Inheritance

All parsers are derived from AbstractParser class.

JSON schema

SnowDDL uses jsonschema Python library to validate YAML configs. JSON Schema for each object type is stored in the same file as parser.

Methods

  • __init__(config: SnowDDLConfig, base_path: Path) Initialize parser with config and Path object with path to config directory.
  • load_blueprints() Abstract method, it is overloaded by each parser class. Read YAML files, build blueprints, add blueprints to config.
  • parse_single_file(path: Path, json_schema: dict, callback: Callable = None) Accept path to YAML file, JSON schema definition, optional callback function. Parse YAML file, validate it with provided JSON schema, process it using callback function. If any Exception was raised inside callback function, it will be considered a config validation error, "muted" and added to .errors property of config. If callback function was not defined, return processed YAML file as Python dict.
  • parse_schema_object_files(object_type: str, json_schema: dict, callback: Callable) Accept name of object type (as string), JSON schema definition, mandatory callback function. Find and parse all files of specified object type, validate each file with provided JSON schema, process each file with callback function. If any Exception was raised inside callback function, it will be considered a config validation error, "muted" and added to .errors property of config.

Parser alternatives

You do not have to use YAML files and parser. You may implement your own classes to build blueprints and populate config. For example, you may use OLTP DMBS as data source.
Last modified 1yr ago