🐍Architecture overview


SnowDDL consists of the following components:

  • Blueprint - pydantic model representing the desired state of an object in Snowflake account;

  • Config - collection of blueprints;

  • Parsers - used to parse YAML config files into blueprints, one parser class per object type;

  • Resolvers - used to compare blueprints with existing metadata in Snowflake account and generate DDL commands to apply changes, one resolver class per object type;

  • Engine - initialized with Snowflake connection and SnowDDL config, used to build, format and execute commands by resolvers.


These components are combined into "applications" with the following workflow:

  1. Initialize an empty config.

  2. Generate individual blueprints using parsers or custom Python code, add blueprints to config.

  3. Validate config. If encountered any errors, display error messages and stop execution.

  4. Open connection to Snowflake using Python connector.

  5. Initialize engine using Snowflake connection and config.

  6. Execute resolvers to generate DDL commands. Suggest or apply DDL commands, depending on settings.

  7. Display statistics, close Snowflake connection and finish the application.

Default application used by CLI interface is available on GitHub: base.py

You may extend the default application to build even more sophisticated automation.

For example, Single DB mode is an extension of default application, which is available in singledb.py.

Last updated