CodeVetter · Repo Unpack · Extension points
sqlalchemy/sqlalchemy
SQLAlchemy exposes explicit extension interfaces at connection, compilation, type, mapping, and event boundaries. Dialects and engine plugins have separate entrypoint registries, and runtime dialect registration is supported. User-defined SQL constructs and types can extend rendering and conversion without replacing the engine pipeline. Mapping registries and events support application-specific behavior, while the dialect compliance suite provides a targeted validation contract for third-party backends.
- The sqlalchemy.dialects registry uses PluginLoader with a built-in auto-loader; register(name, modulepath, objname) installs a runtime import factory.
- CreateEnginePlugin implementations can update URLs, modify dialect/pool keyword arguments, and attach behavior after engine creation; URL query plugins and the plugins argument select them.
- create_engine accepts creator, poolclass, or an existing pool; do_connect listeners can modify connection arguments or return a replacement driver connection.
- event.listen and event.listens_for register target-specific listeners; execution hooks can transform statements and parameters or return a complete ORM result before normal execution.
- @compiles registers default or dialect-specific compilation handlers for expression classes; deregister restores the original dispatch implementation.
- TypeDecorator adds bind/result conversion to an underlying type and can choose dialect-specific implementations; cache_ok declares whether its behavior is safe for statement caching.
- GenericFunction subclasses register automatically with func; register_function also associates named constructs with packages and warns before replacing an existing identifier.
- Mapping registry supports declarative and imperative factories, and external dialect authors are directed to the reusable compliance suite with capability requirements rather than the entire internal test suite.