rusackas opened a new pull request, #43501: URL: https://github.com/apache/superset/pull/43501
### SUMMARY `pyproject.toml`'s `cockroachdb` extra installs the `cockroachdb` PyPI package (last released in 2021, abandoned since). Its SQLAlchemy dialect imports `sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2`, which SQLAlchemy 2.0 removed — so merely constructing a `cockroachdb://` engine raises `ImportError` before any connection is attempted: ``` ImportError: cannot import name 'PGCompiler_psycopg2' from 'sqlalchemy.dialects.postgresql.psycopg2' ``` This has been broken since the SQLAlchemy 2.0 bump (#42803, 2026-08-13, discussion #40273) landed, and nothing catches it: `cockroachdb` isn't part of the default dev/CI install, and the existing `test_crdb.py` only exercises `convert_dttm()` — a pure function — never a real engine. Found while building a testcontainers-based CI pilot and actually connecting to a live CockroachDB instance. The actively maintained replacement is `sqlalchemy-cockroachdb` (currently 2.0.4, versioned to track SQLAlchemy compatibility) — already linked from `CockroachDbEngineSpec.metadata["docs_url"]`, just never wired up as the actual dependency. It registers the same `cockroachdb` SQLAlchemy dialect entry point, so no engine spec code changes are needed beyond the `pypi_packages` metadata. ### TESTING INSTRUCTIONS Added `test_dialect_loads_under_installed_sqlalchemy`, which constructs a `cockroachdb://` engine (no live connection needed — dialect loading fails before any network I/O). Verified directly: ``` pip install "cockroachdb>=0.3.5,<0.4" # old package pytest tests/unit_tests/db_engine_specs/test_crdb.py::test_dialect_loads_under_installed_sqlalchemy # FAILED - ImportError pip uninstall -y cockroachdb pip install "sqlalchemy-cockroachdb>=2.0.0,<3" # this PR's fix pytest tests/unit_tests/db_engine_specs/test_crdb.py # 4 passed ``` Also connected end-to-end against a real CockroachDB container (`cockroachdb/cockroach:v24.1.1` via testcontainers) and ran `select version()` successfully with the fix in place. Added `cockroachdb` to the default dev install (`requirements/development.in`) so this dialect keeps getting exercised going forward instead of silently drifting again. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [x] Removes existing feature or API (the dead `cockroachdb` package dependency; replaced 1:1 with the maintained package covering the same SQLAlchemy dialect) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
