Skip to content

feat(ci): add testcontainers-based db_engine_specs tests (7 dialects) - #43502

Merged
rusackas merged 15 commits into
masterfrom
feat/testcontainers-nightly-pilot
Sep 9, 2026
Merged

rusackas merged 15 commits into
masterfrom
feat/testcontainers-nightly-pilot

Conversation

@rusackas

@rusackas rusackas commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

SUMMARY

Real-container testing of db_engine_specs against actual databases, using testcontainers-python. Existing tests/unit_tests/db_engine_specs/ tests mock the driver/dialect layer entirely, which structurally cannot catch bugs in how SQLAlchemy actually compiles and executes SQL against a real server — e.g. #42899, where Trino emitted OFFSET before LIMIT for paginated queries. Only a real round-trip against a live instance catches that class of bug.

7 dialects, one matrix job each: cockroachdb, crate, trino, mssql, oracle, db2, elasticsearch. All chosen because they're self-hostable via an official Docker image, weren't already covered by real-container CI, and testcontainers-python ships a native container class for each — keeping this PR's own code simple and low-risk.

Runs on a nightly cron and on pull_request, the latter scoped via paths to only PRs touching tests/testcontainers/** or the workflow itself, so unrelated PRs across the repo are never affected. Real measured cost on GitHub's actual runners (not local estimates): the slowest dialect (db2) took 161s; everything else is under 140s. Since each dialect is its own parallel matrix job rather than one job running the whole suite sequentially, total wall-clock for the workflow is bounded by the slowest dialect (~3 minutes including setup), not the sum of all seven (~13 minutes) — a single slow container no longer inflates the cost of the rest.

Three real bugs found building this

  • CockroachDB was completely broken under SQLAlchemy 2.0. The cockroachdb extra installed an abandoned PyPI package whose dialect couldn't even import under 2.0. Nothing caught it because the driver wasn't in the default CI install and the existing mock-only test never constructed a real engine. Fixed in fix(cockroachdb): replace abandoned cockroachdb package with sqlalchemy-cockroachdb #43501 (merge that first — this PR's cockroachdb job depends on it).
  • testcontainers-python's own TrinoContainer.get_connection_url() is broken — it returns the container's internal port instead of the Docker-mapped host port, so the URL it builds can't connect to anything. Worked around locally in test_trino.py; filed upstream: TrinoContainer.get_connection_url() returns the internal port, not the mapped host port testcontainers/testcontainers-python#1111.
  • docker (the Python package) needed a floor bump to 7.2.0 — 7.0.0 raises docker.errors.DockerException: ... Not supported URL scheme http+docker against the requests/urllib3 versions pinned elsewhere in this repo, breaking every testcontainers test before any container is even pulled. Confirmed directly on a real GHA run.

Also confirmed one non-bug

Elasticsearch's SQL layer genuinely does not support OFFSET at all — a real protocol limitation (parsing_exception: mismatched input 'OFFSET'), already correctly documented via ElasticSearchEngineSpec.supports_offset = False. Adjusted that dialect's pagination test to LIMIT/ORDER BY only, matching what Elasticsearch's SQL translator actually supports.

Verification

  • cockroachdb, trino, oracle, elasticsearch: ran locally against real containers, all pass.
  • crate: could not run locally — crate/crate only publishes an amd64 image, and CrateDB's binary requires a host CPU supporting x86-64-v3, which QEMU emulation on Apple Silicon can't satisfy even with docker pull --platform linux/amd64.
  • mssql, db2: could not run locally either — neither publishes an arm64 image (SQL Server on Linux and Db2 Community Edition are both amd64-only). Written against verified library source (dialect names, connection URL construction) and got their first real execution on CI.
  • All 7 dialects are now green on a real GitHub Actions run: https://github.com/apache/superset/actions/runs/32878874944 (one retry needed on db2 for a transient icr.io registry timeout — genuine network flakiness, not a code issue, and exactly the kind of risk a nightly/PR-scoped cadence is meant to absorb rather than block merges on).

Full dialect survey (enumerating everywhere this could go next)

Superset's existing real-container CI coverage before this PR: Postgres, MySQL, Presto, Redis (GH Actions services:) + Hive (custom setup step). Everything below was mock-only or completely untested.

Dialect Current tests Official Docker image testcontainers-python module Status
cockroachdb 0 (real engine untested) Yes, trivial single-node start Native (community.cockroachdb) In this PR
crate 4, mock-only Docker Official Image tier Native (community.cratedb) In this PR — amd64-only, CI-verified only
trino 0 real-container (only Presto is covered) Yes, multi-arch Native (community.trino) In this PR
mssql 12, mock-only Yes, official Microsoft image Native (community.mssql) In this PR — amd64-only, CI-verified only
oracle 7, mock-only Yes, gvenzl/oracle-free (multi-arch) Native (community.oracle) In this PR
db2 7, mock-only Yes, official IBM image Native (community.db2) In this PR — amd64/ppc64le/s390x only, CI-verified only; slowest dialect in the suite (~2.7 min)
elasticsearch varies, mock-only Yes, official Elastic image (multi-arch) Native (community.elasticsearch, generic container) In this PR — read-path only, data indexed via REST API not SQL
databend 12, mock-only Yes, explicitly built for CI use None — needs generic DockerContainer Good next candidate
risingwave 0 Yes, single-container "playground" mode None — needs generic DockerContainer Good next candidate
doris 6, mock-only Yes, all-in-one None Needs AVX2 CPU — untested whether GH's actual runners support it
starrocks 12, mock-only Likely (unverified) None Unverified — needs a follow-up check
solr, druid, dremio, drill, kylin, impala, pinot, ydb, tdengine, singlestore Varies (0–14), mock-only Not verified this pass None verified Worth a dedicated follow-up sweep
vertica 0 Community image only None Excluded — the community image requires a 2-day license verification and expires after 1 year; unsuitable for public CI
snowflake, bigquery, athena, redshift, firebolt, databricks, aurora-data-api, d1, denodo, kusto n/a Cloud-only / SaaS, no local equivalent n/a Excluded permanently — nothing to containerize

To add a dialect: drop a tests/testcontainers/db_engine_specs/test_<dialect>.py following the pattern in this PR (module-scoped container fixture, a LIMIT/OFFSET round-trip where the dialect supports it, a get_columns/get_column_spec introspection check against real server metadata), then add a {dialect, timeout} entry to the workflow's matrix.

TESTING INSTRUCTIONS

pip install -r requirements/development.txt   # now includes testcontainers[cockroachdb,cratedb,db2,mssql,oracle,trino]
pytest tests/testcontainers/db_engine_specs/ -v

Requires a local Docker daemon. crate, mssql, db2 need an x86_64 host (no arm64 images) — they'll only actually run on CI if you're on Apple Silicon, though they still collect cleanly.

Or trigger the workflow directly via workflow_dispatch from the Actions tab, or via gh workflow run testcontainers.yml.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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 (new CI workflow + tests/testcontainers/ test category)
  • Removes existing feature or API

@bito-code-review

bito-code-review Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #723c20

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • tests/testcontainers/db_engine_specs/test_crate.py - 1
Review Details
  • Files reviewed - 7 · Commit Range: d1870a3..d1870a3
    • requirements/development.in
    • requirements/development.txt
    • tests/testcontainers/__init__.py
    • tests/testcontainers/db_engine_specs/__init__.py
    • tests/testcontainers/db_engine_specs/test_cockroachdb.py
    • tests/testcontainers/db_engine_specs/test_crate.py
    • tests/testcontainers/db_engine_specs/test_trino.py
  • Files skipped - 1
    • .github/workflows/nightly-testcontainers.yml - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added github_actions Pull requests that update GitHub Actions code preset-io labels Aug 25, 2026
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The current test likely only verifies the existence of a column specification without validating that the specific native type (e.g., INTEGER) is correctly mapped to the expected SQLAlchemy or generic type. To resolve this, you should update the test to assert the specific mapped type and generic type for the column.

Since I do not have access to the file content of tests/testcontainers/db_engine_specs/test_trino.py in this environment, I cannot provide the exact code implementation. Please verify the test logic and add an assertion that checks the type attribute of the column object returned by get_columns against the expected SQLAlchemy type.

Regarding other comments on this PR, I have checked the available review data and found no other comments to address. If you have additional comments you would like me to review, please provide them.

@codecov

codecov Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.89%. Comparing base (986b648) to head (7076801).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #43502   +/-   ##
=======================================
  Coverage   79.89%   79.89%           
=======================================
  Files        2916     2916           
  Lines      170755   170761    +6     
  Branches    39569    39570    +1     
=======================================
+ Hits       136429   136437    +8     
+ Misses      31808    31806    -2     
  Partials     2518     2518           
Flag Coverage Δ
hive 37.62% <100.00%> (+<0.01%) ⬆️
mysql 57.39% <100.00%> (+<0.01%) ⬆️
postgres 57.42% <100.00%> (+<0.01%) ⬆️
presto 39.54% <100.00%> (+<0.01%) ⬆️
python 84.33% <100.00%> (+<0.01%) ⬆️
sqlite 57.11% <100.00%> (+<0.01%) ⬆️
unit 75.38% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

rusackas added a commit that referenced this pull request Aug 25, 2026
Address bot review feedback on #43502: the integration test only
checked that a ColumnSpec existed, not that INTEGER columns actually
mapped to the numeric generic type and an Integer sqla type.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bito-code-review

bito-code-review Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #fb7d57

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: d1870a3..8b2f317
    • tests/testcontainers/db_engine_specs/test_trino.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@netlify

netlify Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 7076801
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aa0b319a2cbcd00091f541f
😎 Deploy Preview https://deploy-preview-43502--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

rusackas pushed a commit that referenced this pull request Aug 25, 2026
docker==7.0.0 (the previously-unpinned floor) raises
`docker.errors.DockerException: ... Not supported URL scheme http+docker`
against the requests/urllib3 versions pinned elsewhere in this file --
confirmed on a real GHA run of #43502's nightly-testcontainers workflow,
where every test errored before any container was even pulled. 7.2.0 is
confirmed working, both locally and against a live container.
@rusackas rusackas changed the title feat(ci): add nightly testcontainers-based db_engine_specs tests feat(ci): add testcontainers-based db_engine_specs tests (7 dialects) Aug 25, 2026

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #23364e

Actionable Suggestions - 1
  • tests/testcontainers/db_engine_specs/test_db2.py - 1
    • Duplicate paginated query test function · Line 53-53
Additional Suggestions - 1
  • tests/testcontainers/db_engine_specs/test_elasticsearch.py - 1
    • Magic number timeout value · Line 50-50
      Extract the repeated magic number `10` (seconds) to a named module-level constant `_REQUEST_TIMEOUT_SECONDS` to improve maintainability and make timeout adjustments easier to reason about.
Review Details
  • Files reviewed - 9 · Commit Range: 8b2f317..4233992
    • pyproject.toml
    • requirements/development.txt
    • requirements/development.in
    • tests/testcontainers/db_engine_specs/test_db2.py
    • tests/testcontainers/db_engine_specs/test_elasticsearch.py
    • tests/testcontainers/db_engine_specs/test_mssql.py
    • tests/testcontainers/db_engine_specs/test_oracle.py
    • superset/db_engine_specs/cockroachdb.py
    • tests/unit_tests/db_engine_specs/test_crdb.py
  • Files skipped - 3
    • .github/workflows/nightly-testcontainers.yml - Reason: Filter setting
    • .github/workflows/testcontainers.yml - Reason: Filter setting
    • UPDATING.md - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

rusackas pushed a commit that referenced this pull request Sep 6, 2026
docker==7.0.0 (the previously-unpinned floor) raises
`docker.errors.DockerException: ... Not supported URL scheme http+docker`
against the requests/urllib3 versions pinned elsewhere in this file --
confirmed on a real GHA run of #43502's nightly-testcontainers workflow,
where every test errored before any container was even pulled. 7.2.0 is
confirmed working, both locally and against a live container.
rusackas added a commit that referenced this pull request Sep 6, 2026
The "paginated query returns correct rows in order" test body was
duplicated verbatim across cockroachdb/crate/db2/mssql/oracle/trino's
testcontainers suites. Factor the shared table-setup/assert logic into
_pagination.py, with an optional post-insert hook for CrateDB's
eventual-consistency REFRESH TABLE step; each call site keeps its own
test function and dialect-specific docstring.

Addresses bito-code-review feedback on #43502.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rusackas
rusackas force-pushed the feat/testcontainers-nightly-pilot branch from 1eadf35 to 3d8ba4e Compare September 6, 2026 05:28
@rusackas rusackas removed the requires:rebase Requires rebasing on top of current master label Sep 6, 2026
@bito-code-review

bito-code-review Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #abae72

Actionable Suggestions - 0
Additional Suggestions - 7
  • superset/db_engine_specs/__init__.py - 1
    • Global dict race · Line 210-213
      `get_available_engine_specs()` runs per-request via `databases/api.py available()` and `views/base.py cached_common_bootstrap_data()`. In a threaded server, the `finally` block's non-atomic `OPERATORS.clear()` + `update()` can interleave with another thread compiling SQL, causing a `KeyError` or wrong rendering; a snapshot taken mid-mutation also clobbers legitimate state. Consider a `threading.Lock` around snapshot/load/restore.
  • tests/testcontainers/db_engine_specs/test_db2.py - 1
    • Case-sensitive column assertion · Line 92-92
      Db2 folds unquoted identifiers to uppercase in the catalog, so the inspector reports these columns as `ID`/`AMOUNT`, not `id`/`amount`. `set(by_name) == {"id", "amount"}` will fail against a real instance. Compare case-insensitively (e.g. `.lower()`) or assert the uppercase names.
  • tests/testcontainers/db_engine_specs/test_elasticsearch.py - 1
    • Weak type-mapping assertion · Line 107-107
      `assert spec is not None` is vacuous for the ES `long` type: base `get_column_spec` returns `None` only when no mapping matches, so this passes even if the mapping were wrong. Strengthen it to actually validate the mapping, matching the sibling `test_mongodb.py`: assert `spec.generic_type == GenericDataType.NUMERIC` and `isinstance(spec.sqla_type, Float)`. This requires adding `Float` to the sqlalchemy import and importing `GenericDataType` from `superset.utils.core`.
  • tests/testcontainers/db_engine_specs/test_clickhouse.py - 2
    • Inaccurate docstring rationale · Line 33-36
      The docstring claims importing `superset.db_engine_specs.clickhouse` outside an app context raises RuntimeError, but the module guards `current_app.config` with `has_app_context()` (clickhouse.py:373-375), so the import is safe. The `app.app_context()` push in `test_get_columns_maps_native_types` is therefore unnecessary; consider dropping it and correcting the rationale.
    • Unpinned container image · Line 79-79
      The rest of this testcontainers suite pins exact image versions (elasticsearch:8.11.0, mariadb:11, mongo:7.0.7, mysql:8.0, postgres:17-alpine, timescale:2.29.2-pg16). Using `clickhouse/clickhouse-server:latest` here makes results non-reproducible and can cause flaky CI when upstream releases change behavior. Consider pinning a specific tag.
  • requirements/development.in - 2
    • Inaccurate comment · Line 34-35
      The comment groups yugabytedb with mariadb/timescaledb as 'reuse the postgres/mysql container classes', but `test_yugabytedb.py` uses a generic `DockerContainer` (its docstring says `PostgresContainer` can't be used). The rationale is still correct (no extra needed), but the stated reason is inaccurate.
    • Inaccurate comment · Line 41-43
      The comment says StarRocks' test uses 'the same mysqlclient the mysql extra already provides', but `test_starrocks.py` requires the `starrocks` driver (via `require_driver("starrocks")`), not mysqlclient. The conclusion (no testcontainers extra needed) is right; the stated dependency is wrong.
Review Details
  • Files reviewed - 34 · Commit Range: c665c23..3d8ba4e
    • pyproject.toml
    • pytest.ini
    • requirements/development.in
    • requirements/development.txt
    • superset/db_engine_specs/__init__.py
    • superset/db_engine_specs/clickhouse.py
    • superset/db_engine_specs/cockroachdb.py
    • tests/integration_tests/databases/api_tests.py
    • tests/testcontainers/__init__.py
    • tests/testcontainers/db_engine_specs/__init__.py
    • tests/testcontainers/db_engine_specs/_driver.py
    • tests/testcontainers/db_engine_specs/_pagination.py
    • tests/testcontainers/db_engine_specs/test_clickhouse.py
    • tests/testcontainers/db_engine_specs/test_cockroachdb.py
    • tests/testcontainers/db_engine_specs/test_crate.py
    • tests/testcontainers/db_engine_specs/test_databend.py
    • tests/testcontainers/db_engine_specs/test_db2.py
    • tests/testcontainers/db_engine_specs/test_elasticsearch.py
    • tests/testcontainers/db_engine_specs/test_firebird.py
    • tests/testcontainers/db_engine_specs/test_mariadb.py
    • tests/testcontainers/db_engine_specs/test_monetdb.py
    • tests/testcontainers/db_engine_specs/test_mongodb.py
    • tests/testcontainers/db_engine_specs/test_mssql.py
    • tests/testcontainers/db_engine_specs/test_mysql.py
    • tests/testcontainers/db_engine_specs/test_oceanbase.py
    • tests/testcontainers/db_engine_specs/test_oracle.py
    • tests/testcontainers/db_engine_specs/test_postgres.py
    • tests/testcontainers/db_engine_specs/test_risingwave.py
    • tests/testcontainers/db_engine_specs/test_starrocks.py
    • tests/testcontainers/db_engine_specs/test_timescaledb.py
    • tests/testcontainers/db_engine_specs/test_trino.py
    • tests/testcontainers/db_engine_specs/test_ydb.py
    • tests/testcontainers/db_engine_specs/test_yugabytedb.py
    • tests/unit_tests/db_engine_specs/test_init.py
  • Files skipped - 3
    • .github/workflows/testcontainers.yml - Reason: Filter setting
    • UPDATING.md - Reason: Filter setting
    • docs/src/data/databases.json - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Superset Dev and others added 15 commits September 8, 2026 18:03
Pilot for real-container testing of db_engine_specs against actual
databases (CockroachDB, CrateDB, Trino), via testcontainers-python.
Existing unit tests mock the driver/dialect layer entirely, which cannot
catch real SQL-compilation or type-mapping bugs -- e.g. #42899, where
Trino emitted OFFSET before LIMIT for paginated queries.

Runs nightly (.github/workflows/nightly-testcontainers.yml), not on every
merge: container pulls and startup are slower and more flake-prone than
the existing mocked unit tests, and this measures that cost/signal
tradeoff before considering wider adoption.

Building this surfaced two real bugs, fixed/documented separately:
- The cockroachdb dialect was completely broken under SQLAlchemy 2.0 due
  to a dead upstream package -- fixed in #43501.
- testcontainers-python's TrinoContainer.get_connection_url() returns the
  container-internal port instead of the Docker-mapped host port; worked
  around locally, filed upstream.
Address bot review feedback on #43502: the integration test only
checked that a ColumnSpec existed, not that INTEGER columns actually
mapped to the numeric generic type and an Integer sqla type.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a scoped pull_request trigger so this workflow runs on this PR
itself, to get real GHA runner timing before deciding whether/how to
adopt this pattern more broadly. Also adds the actions-timeline job
(same pattern as superset-python-presto-hive.yml) to visualize per-step
duration.

Revert the pull_request trigger before merge -- it's here to measure
cost, not to become a permanent merge-blocking check.
docker==7.0.0 (the previously-unpinned floor) raises
`docker.errors.DockerException: ... Not supported URL scheme http+docker`
against the requests/urllib3 versions pinned elsewhere in this file --
confirmed on a real GHA run of #43502's nightly-testcontainers workflow,
where every test errored before any container was even pulled. 7.2.0 is
confirmed working, both locally and against a live container.
…icsearch

Adds four more dialects to the testcontainers suite (cockroachdb, crate,
trino from the initial pilot): mssql, oracle, db2, elasticsearch. All four
have native testcontainers-python container classes.

Restructures the workflow from one job running the whole suite to a
matrix, one job per dialect, running in parallel. A single slow container
would otherwise inflate wall-clock time for every dialect, not just its
own -- matrixing bounds total suite time by the slowest dialect instead of
the sum of all of them. Also renames the workflow file/name from
"Nightly-Testcontainers" to "Testcontainers" now that it runs on
pull_request (scoped via `paths`) in addition to the nightly cron.

Elasticsearch needed a different data-setup approach than the SQL-native
dialects: indices/documents get created via its REST API, not SQL INSERT,
matching how Superset actually encounters Elasticsearch in practice.
Confirmed empirically that Elasticsearch's SQL layer has no OFFSET support
at all (a real protocol limitation, already correctly documented via
ElasticSearchEngineSpec.supports_offset = False) and adjusted that
dialect's pagination test accordingly -- LIMIT/ORDER BY only, no OFFSET.

mssql and db2 could not be verified locally (no arm64 images for either;
this environment is Apple Silicon), same situation as crate's amd64-only
image from the initial pilot. Both are written against verified library
source (dialect names, connection URL construction) and will get their
first real execution on CI.
…my-cockroachdb

The `cockroachdb` PyPI package (last released 2021) is abandoned, and its
SQLAlchemy dialect references sqlalchemy.dialects.postgresql.psycopg2's
PGCompiler_psycopg2, which SQLAlchemy 2.0 removed. Constructing a
cockroachdb:// engine has raised ImportError since the SQLAlchemy 2.0 bump
(#42803) landed, with nothing catching it: the driver isn't part of the
default dev/CI install, and the existing test_crdb.py only exercises
convert_dttm(), never a real engine.

Switches the `cockroachdb` extra to sqlalchemy-cockroachdb, the actively
maintained replacement already linked from CockroachDbEngineSpec's own
docs_url, adds it to the default dev install so this keeps getting
exercised, and adds a regression test that constructs a real engine
(verified to fail against the old package, pass against the new one).
…m mssql extra

Adding the mssql extra to development.in for testcontainers coverage
installs pymssql in the dev/test env, so the existing
mssql+pymssql://url probe in test_test_connection_failed no longer
hits the "driver not found" path it was meant to exercise -- it now
attempts a real (failing) connection instead. Swap it for a
dialect+driver URI whose dialect will never resolve to an installed
extra.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The "paginated query returns correct rows in order" test body was
duplicated verbatim across cockroachdb/crate/db2/mssql/oracle/trino's
testcontainers suites. Factor the shared table-setup/assert logic into
_pagination.py, with an optional post-insert hook for CrateDB's
eventual-consistency REFRESH TABLE step; each call site keeps its own
test function and dialect-specific docstring.

Addresses bito-code-review feedback on #43502.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…CI isolation, and test rigor

- pyproject.toml: pin psycopg2-binary alongside sqlalchemy-cockroachdb --
  the latter declares no DBAPI dependency of its own, so the documented
  `apache-superset[cockroachdb]` install couldn't actually connect.
- testcontainers.yml: scope the concurrency group by ref so a PR run and
  the nightly cron (or two different PRs) no longer cancel each other.
- test_cockroachdb.py: assert the actual generic/SQLAlchemy type, matching
  the Trino test, instead of only checking a column spec was found.
- pytest.ini + new `testcontainers` marker + _driver.py: exclude
  tests/testcontainers/ from a plain `pytest` run by default (it needs
  Docker), while the dedicated CI job now sets
  SUPERSET_TESTCONTAINERS_STRICT so a broken/missing driver import fails
  that job instead of silently skipping to a green, zero-tests-run result.
- UPDATING.md: the migration note now says to uninstall the old
  `cockroachdb` package outright, since reinstalling the extra alone can
  leave both packages registering the same dialect entry point.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…cockroachdb DBAPI docs, stale workflow refs)

- requirements/development.in + testcontainers.yml: scope the `db2` extra
  (`ibm-db-sa`/`ibm-db`) out of the baseline dev install. `ibm-db` ships no
  Linux arm64 wheel, so bundling it there broke the multi-platform dev
  Docker image build on push. The testcontainers CI job now installs it
  directly, only for its own db2 matrix leg.
- cockroachdb.py: list `psycopg2-binary` alongside `sqlalchemy-cockroachdb`
  in the `pypi_packages` metadata, since a plain `cockroachdb://` URL can't
  connect without a DBAPI and sqlalchemy-cockroachdb doesn't install one.
- test_cockroachdb.py/test_crate.py/test_trino.py: fix stale docstring
  references to the old `nightly-testcontainers.yml` filename.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The db2 testcontainers extra pulls in ibm-db/ibm-db-sa transitively;
the pinned lockfile was missing those entries.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…abytedb, monetdb, mongodb (#43640)

Co-authored-by: Superset Dev <dev@superset.apache.org>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…43662)

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: hainenber <dotronghai96@gmail.com>
Signed-off-by: Gabriel Torres Ruiz <gabo2595@gmail.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Superset Dev <dev@superset.apache.org>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Milad Rashidikhah <mrashidikhah32@gmail.com>
Co-authored-by: bucketbase26 <singhayush062006@gmail.com>
Co-authored-by: Joe Li <joe@preset.io>
Co-authored-by: Viktor Högberg <119532259+vhogberg@users.noreply.github.com>
Co-authored-by: joey <97154801+chkang83@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Chandan P <95340276+NoiceHax@users.noreply.github.com>
Co-authored-by: Mafi <matt.fitzgerald@gmail.com>
Co-authored-by: Matt Fitzgerald <matt.fitzgerald@preset.io>
Co-authored-by: Enzo Martellucci <52219496+EnxDev@users.noreply.github.com>
Co-authored-by: Alexandru Soare <37236580+alexandrusoare@users.noreply.github.com>
Co-authored-by: Mehmet Salih Yavuz <salih.yavuz@proton.me>
Co-authored-by: Sanmitra Nagaraj <48400413+s1ny1998@users.noreply.github.com>
Co-authored-by: Lalith Kothuru <lalith.kothuru@gmail.com>
Co-authored-by: shaurya <shauryajaiswal.dev@gmail.com>
Co-authored-by: Shaurya <19599684+no-hup@users.noreply.github.com>
Co-authored-by: Đỗ Trọng Hải <41283691+hainenber@users.noreply.github.com>
Co-authored-by: rlei <242280117+rlei-odes@users.noreply.github.com>
Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
Co-authored-by: Gabriel Torres Ruiz <gabo2595@gmail.com>
Co-authored-by: hainenber <dotronghai96@gmail.com>
Co-authored-by: ʈᵃᵢ <tai@apache.org>
Co-authored-by: Mike Bridge <michael.bridge@preset.io>
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
Co-authored-by: Francesco.Castaldi <info@francescocastaldi.it>
Co-authored-by: FrancescoCastaldi <francesco.castaldi@mapsgroup.it>
Co-authored-by: Abdul Rehman <76230556+Abdulrehman-PIAIC80387@users.noreply.github.com>
Co-authored-by: Sepuri Sai Krishna <saik20533@gmail.com>
Co-authored-by: Mallikarjuna Reddy Nimmakayala <mallikarjunareddy.nimmakayala@gmail.com>
Co-authored-by: PRATHAMESH HUKKERI <prathamhukkeri04@gmail.com>
Co-authored-by: Prathamesh Hukkeri <prathamesh04@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: SBIN2010 <Sbin2010@mail.ru>
…ase extra as unresolvable

- docs/src/data/databases.json: the rendered CockroachDB setup docs still
  listed the abandoned `cockroachdb` PyPI package instead of the
  `sqlalchemy-cockroachdb`/`psycopg2-binary` pair pyproject.toml actually
  installs.
- pyproject.toml: document that `pip install apache-superset[oceanbase]`
  cannot resolve (oceanbase_py pins sqlalchemy-utils<0.39, conflicting with
  Superset's own >=0.42.1 pin); CI installs the driver standalone with
  --no-deps instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The `oceanbase` extra pinned oceanbase_py, whose sqlalchemy-utils range
conflicts outright with Superset's own pin, so `pip install
apache-superset[oceanbase]` could never resolve. CI already installs
oceanbase_py standalone with --no-deps, so drop the unusable extra and
keep the rationale as a comment instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
with:
persist-credentials: false
- name: Setup Python
uses: ./.github/actions/setup-backend/
@bito-code-review

bito-code-review Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #0ff7ca

Actionable Suggestions - 0
Additional Suggestions - 2
  • requirements/development.in - 1
    • Inaccurate comment rationale · Line 34-37
      The comment says yugabytedb "reuse[s] the postgres/mysql container classes", but `test_yugabytedb.py` uses a generic `DockerContainer` (PostgresContainer can't drive its `ysqlsh`). Only mariadb and timescaledb reuse MySqlContainer/PostgresContainer. The conclusion (no extra needed) is right, but the rationale is inaccurate and could mislead future maintainers.
  • tests/testcontainers/db_engine_specs/test_clickhouse.py - 1
    • Stale docstring claim · Line 33-41
      The docstring states importing `superset.db_engine_specs.clickhouse` outside an app context raises RuntimeError because module-level code dereferences `current_app.config`. But clickhouse.py:374 guards that lookup with `has_app_context()` and falls back to "dev", so the import does not raise. The `app.app_context()` push at lines 108-109 is defensive, not required. Consider correcting the docstring to avoid misleading future maintainers.
Review Details
  • Files reviewed - 34 · Commit Range: 8aefbf9..7076801
    • pyproject.toml
    • pytest.ini
    • requirements/development.in
    • requirements/development.txt
    • superset/db_engine_specs/__init__.py
    • superset/db_engine_specs/clickhouse.py
    • superset/db_engine_specs/cockroachdb.py
    • tests/integration_tests/databases/api_tests.py
    • tests/testcontainers/__init__.py
    • tests/testcontainers/db_engine_specs/__init__.py
    • tests/testcontainers/db_engine_specs/_driver.py
    • tests/testcontainers/db_engine_specs/_pagination.py
    • tests/testcontainers/db_engine_specs/test_clickhouse.py
    • tests/testcontainers/db_engine_specs/test_cockroachdb.py
    • tests/testcontainers/db_engine_specs/test_crate.py
    • tests/testcontainers/db_engine_specs/test_databend.py
    • tests/testcontainers/db_engine_specs/test_db2.py
    • tests/testcontainers/db_engine_specs/test_elasticsearch.py
    • tests/testcontainers/db_engine_specs/test_firebird.py
    • tests/testcontainers/db_engine_specs/test_mariadb.py
    • tests/testcontainers/db_engine_specs/test_monetdb.py
    • tests/testcontainers/db_engine_specs/test_mongodb.py
    • tests/testcontainers/db_engine_specs/test_mssql.py
    • tests/testcontainers/db_engine_specs/test_mysql.py
    • tests/testcontainers/db_engine_specs/test_oceanbase.py
    • tests/testcontainers/db_engine_specs/test_oracle.py
    • tests/testcontainers/db_engine_specs/test_postgres.py
    • tests/testcontainers/db_engine_specs/test_risingwave.py
    • tests/testcontainers/db_engine_specs/test_starrocks.py
    • tests/testcontainers/db_engine_specs/test_timescaledb.py
    • tests/testcontainers/db_engine_specs/test_trino.py
    • tests/testcontainers/db_engine_specs/test_ydb.py
    • tests/testcontainers/db_engine_specs/test_yugabytedb.py
    • tests/unit_tests/db_engine_specs/test_init.py
  • Files skipped - 3
    • .github/workflows/testcontainers.yml - Reason: Filter setting
    • UPDATING.md - Reason: Filter setting
    • docs/src/data/databases.json - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:connect:cockroachdb Related to Cockroach data:connect:trino Related to Trino dependencies:python doc Namespace | Anything related to documentation github_actions Pull requests that update GitHub Actions code infra:container Infra container and K8s preset-io size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants