mirror of
https://github.com/apache/superset.git
synced 2026-05-29 20:29:34 +00:00
Wires up _ENGINE_CACHE — a module-level dict keyed by (database_id, str(sqlalchemy_url), repr(sorted(engine_kwargs.items()))) — so that successive _get_sqla_engine(nullpool=False) calls reuse the same Engine instance instead of building a fresh one each invocation. Per SQLAlchemy docs the engine is meant to live for the process lifetime; recreating defeats every pool an operator configures via DB_CONNECTION_MUTATOR (the original bug report's duckdb queue-size-1 seeing multiple simultaneous connections). nullpool=True engines are skipped — those are intentionally poolless and there's nothing to reuse. The regression test added in the prior commit clears _ENGINE_CACHE in its setup so test ordering can't smuggle a stale entry past the assertion. Closes #27897