🟣Config

Config is a collection of blueprints.

Config is represented by class SnowDDLConfig, which is located in config.py.

Methods

  • __init__(env_prefix=None) Initialize config with optional env prefix, which should be applied to all blueprints.

  • get_blueprints_by_type(cls: Type[T_Blueprint]) -> Dict[str,T_Blueprint] Accepts blueprint type (class). Returns all blueprints of this type.

  • get_blueprints_by_type_and_pattern(cls: Type[T_Blueprint], pattern: str) -> Dict[str,T_Blueprint]) Accepts blueprint type (class) and Unix-style pattern. Returns all blueprints of this type with full names matching pattern. Example of pattern: db1.sc1.my_tables_*

  • add_blueprint(bp: AbstractBlueprint) Accept instance of blueprint. Add this blueprint to collection. If blueprint of this type with the same full_name already exists, it will be replaced.

  • remove_blueprint(bp: AbstractBlueprint) Accepts instance of blueprint. Removes this blueprint from collection. Throws ValueError exception if blueprint does not exist in config.

  • add_error(path: Path, e: Exception) Accepts path object (usually to YAML config file or file with Python module) and instance of exception. Adds config validation error.

Properties

  • .env_prefix (str) - normalized env prefix, upper cased and with __ at the end. It should be used to build object identifiers.

  • .blueprints (dict) - blueprints in collection.

    • {key} (type) - blueprint type (class).

    • {value} (dict)

      • {key} (str) - full name of object, stored as string.

      • {value} (blueprint) - blueprint dataclass object.

  • .errors (list) - validation errors.

    • {items} (dict)

      • path (Path) - path to file (or something else) which caused error.

      • error (Exception) - exception object.

  • .placeholders (dict) - placeholders used by parsers during processing of YAML configs.

    • {key} (str) - name of placeholder.

    • {value} (bool, float, int, str) - value of placeholder.

Last updated