Description
SQLSpecPlugin.get_config(name) raises ImproperConfigurationError ("SQLSpec plugin has not been registered with a Litestar application") for both type-based and string-key lookups until on_app_init has run.
The plugin already holds its SQLSpec registry at construction, and that registry knows every registered config, so type/bind-key resolution could be answered without any app-registration state. The registered-app requirement only seems necessary for the DI-key lookups (db_session, db_connection, ...) that are derived during on_app_init.
Use case
Composition roots that build app-scoped adapters/services from the plugin before (or outside) Litestar app construction — e.g. background workers and CLI entry points that share the same wiring. Today the only pre-registration paths are walking plugin.config manually or reaching into the private plugin._sqlspec.
Proposal
- Let
get_config(<config type>) and get_config(<bind_key>) resolve from the wrapped registry regardless of registration state, keeping the registered-app requirement only for DI-key string lookups.
- Optionally expose the wrapped registry as a public property (e.g.
plugin.sqlspec) so integrators don't need _sqlspec.
Version
sqlspec 0.58.x (litestar extension)
Description
SQLSpecPlugin.get_config(name)raisesImproperConfigurationError("SQLSpec plugin has not been registered with a Litestar application") for both type-based and string-key lookups untilon_app_inithas run.The plugin already holds its
SQLSpecregistry at construction, and that registry knows every registered config, so type/bind-key resolution could be answered without any app-registration state. The registered-app requirement only seems necessary for the DI-key lookups (db_session,db_connection, ...) that are derived duringon_app_init.Use case
Composition roots that build app-scoped adapters/services from the plugin before (or outside) Litestar app construction — e.g. background workers and CLI entry points that share the same wiring. Today the only pre-registration paths are walking
plugin.configmanually or reaching into the privateplugin._sqlspec.Proposal
get_config(<config type>)andget_config(<bind_key>)resolve from the wrapped registry regardless of registration state, keeping the registered-app requirement only for DI-key string lookups.plugin.sqlspec) so integrators don't need_sqlspec.Version
sqlspec 0.58.x (litestar extension)