Files
superset2/tests/unit_tests
Claude 9a6f76c992 fix(database): cache sqla engine per process per URL (#27897)
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
2026-05-20 14:29:10 -07:00
..
2024-05-29 19:04:37 -07:00
2024-05-29 19:04:37 -07:00
2025-09-12 09:21:37 +01:00