Skip to content

feat(ci): expand testcontainers coverage to mariadb, timescaledb, yugabytedb, monetdb, mongodb - #43640

Merged
rusackas merged 9 commits into
feat/testcontainers-nightly-pilotfrom
feat/testcontainers-more-dialects
Aug 30, 2026
Merged

rusackas merged 9 commits into
feat/testcontainers-nightly-pilotfrom
feat/testcontainers-more-dialects

Conversation

@rusackas

Copy link
Copy Markdown
Member

SUMMARY

Stacked on #43502 (the 7-dialect testcontainers pilot) — adds 5 more dialects from the docs-supported list: mariadb, timescaledb, yugabytedb, monetdb, mongodb. All 5 verified locally against real containers except mariadb (mysqlclient has a pre-existing, unrelated native-library issue on this dev machine's Homebrew setup — same accepted CI-only-verification pattern already used for crate/mssql/db2 in the base branch).

Wire-compatible dialects (near-zero new container code)

mariadb, timescaledb, and yugabytedb are all wire-compatible with an existing base dialect, so they reuse testcontainers' MySqlContainer/PostgresContainer classes pointed at a different image rather than needing new container-class wiring — mariadb:11, timescale/timescaledb:latest-pg16, and yugabytedb/yugabyte:latest respectively.

yugabytedb needed one adjustment though: PostgresContainer's built-in readiness check execs psql, which the yugabyte image doesn't ship (only its own ysqlsh). Used a generic DockerContainer instead, started via yugabyted start --background=false and waiting on yugabyted's own final startup log line ("Data placement constraint successfully verified").

monetdb (no native testcontainers module)

Uses a generic DockerContainer with the documented MDB_* environment variables and a log-based wait strategy. Publishes an amd64-only image — confirmed it actually runs under Rosetta/QEMU emulation on Apple Silicon (unlike CrateDB, which fails outright on its x86-64-v3 CPU instruction-set requirement even under emulation).

mongodb (two real bugs found writing this one)

MongoDB is schemaless, and Superset talks to it via pymongosql, a SQL-to-MongoDB translation layer requiring a ?mode=superset query param. Documents get inserted via the native pymongo driver rather than SQL INSERT, matching how Superset actually encounters MongoDB in practice and avoiding any assumption about pymongosql's own INSERT/DDL support.

Two bugs surfaced empirically while wiring this up: MongoDbContainer.get_connection_url() has no database path segment or query string at all, so naively appending "&mode=superset" glued directly onto the port number instead of starting a query string — fixed by building the full URL manually. And the root user MongoDbContainer creates lives in the admin database, so connecting with a different default database in the URL path fails authentication outright unless authSource=admin is specified explicitly.

Confirmed pymongosql actually supports OFFSET (it maps to MongoDB's native skip), unlike Elasticsearch's SQL layer in the base PR, which has no OFFSET support at all — so this one keeps the full LIMIT/OFFSET pagination test rather than the LIMIT-only version.

New extras added

monetdb (sqlalchemy-monetdb, pymonetdb) and mongodb (pymongosql) are genuinely new pyproject.toml extras. mariadb, timescaledb, and yugabytedb are added as thin aliases (apache-superset[mysql] / apache-superset[postgres]) since they need no new packages — mysqlclient/psycopg2-binary are already pulled in via the existing mysql/postgres extras.

TESTING INSTRUCTIONS

pip install -r requirements/development.txt
pytest -m testcontainers tests/testcontainers/db_engine_specs/test_monetdb.py tests/testcontainers/db_engine_specs/test_mongodb.py tests/testcontainers/db_engine_specs/test_timescaledb.py tests/testcontainers/db_engine_specs/test_yugabytedb.py -v

8 passed locally. mariadb needs CI (Linux) to verify due to the local mysqlclient issue noted above.

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 (5 more testcontainers dialects)
  • Removes existing feature or API

…abytedb, monetdb, mongodb

Adds five more dialects to the testcontainers suite, stacked on top of the
7-dialect pilot in feat/testcontainers-nightly-pilot: mariadb, timescaledb,
yugabytedb, monetdb, mongodb.

mariadb, timescaledb, and yugabytedb are all wire-compatible with an
existing base dialect (MySQL and Postgres respectively), so they reuse
testcontainers' MySqlContainer/PostgresContainer classes pointed at a
different image rather than needing new container-class wiring.
yugabytedb specifically cannot reuse PostgresContainer's built-in
readiness check, though: that execs `psql`, which the yugabyte image
doesn't ship (only its own `ysqlsh`) -- uses a generic DockerContainer
instead, started via `yugabyted start` and waiting on its own final
startup log line.

monetdb has no native testcontainers module; uses a generic DockerContainer
with the documented MDB_* environment variables. Publishes an amd64-only
image (confirmed running under Rosetta/QEMU emulation on Apple Silicon,
unlike CrateDB's harder x86-64-v3 CPU requirement).

mongodb needed a different data-setup approach, like elasticsearch before
it: documents get inserted via the native pymongo driver, not SQL INSERT,
since MongoDB is schemaless and Superset talks to it through pymongosql
(a SQL-to-MongoDB translation layer requiring a `?mode=superset` query
param). Two real bugs surfaced writing this one: testcontainers'
MongoDbContainer.get_connection_url() has no database path or query
string at all, so naively appending "&mode=superset" glued directly onto
the port number instead of starting a query string; and the root user
MongoDbContainer creates lives in the `admin` database, so connecting
with a different default database in the URL requires authSource=admin
or authentication fails outright. Confirmed pymongosql supports OFFSET
(maps to MongoDB's native `skip`), unlike Elasticsearch's SQL layer.

mariadb could not be verified locally in this environment: mysqlclient
(MySQLdb) has a pre-existing, unrelated native-library linking issue
against this machine's Homebrew-installed libmysqlclient. CI installs it
via apt on Linux, where this does not occur -- same accepted pattern
already used for crate/mssql/db2 in the base branch.
@dosubot dosubot Bot added data:connect:mariadb Related to a specific database data:connect:timscaledb github_actions Pull requests that update GitHub Actions code install:dependencies Installation - Dependencies labels Aug 28, 2026
@bito-code-review

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

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped - Branch Excluded

Bito didn't auto-review because the source or target branch is excluded from automatic reviews.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the branch exclusion settings here, or contact your Bito workspace admin at [email protected].

@codecov

codecov Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.17%. Comparing base (dff961a) to head (9cecbf2).
⚠️ Report is 1 commits behind head on feat/testcontainers-nightly-pilot.

Additional details and impacted files
@@                        Coverage Diff                         @@
##           feat/testcontainers-nightly-pilot   #43640   +/-   ##
==================================================================
  Coverage                              79.17%   79.17%           
==================================================================
  Files                                   2879     2879           
  Lines                                 165819   165825    +6     
  Branches                               38330    38331    +1     
==================================================================
+ Hits                                  131291   131298    +7     
+ Misses                                 32055    32054    -1     
  Partials                                2473     2473           
Flag Coverage Δ
hive 37.95% <100.00%> (+<0.01%) ⬆️
mysql 57.68% <100.00%> (+<0.01%) ⬆️
postgres 57.72% <100.00%> (+<0.01%) ⬆️
presto 39.87% <100.00%> (+<0.01%) ⬆️
python 83.75% <100.00%> (+<0.01%) ⬆️
sqlite 57.40% <100.00%> (+<0.01%) ⬆️
unit 73.97% <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.

Comment thread requirements/development.in Resolved
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. Including db2 in the testcontainers extra in requirements/development.in forces the installation of ibm-db-sa, which lacks Linux arm64 wheels and breaks the multi-platform development image build. To resolve this, remove db2 from the testcontainers list in requirements/development.in as suggested.

Would you like me to fetch all other comments on this PR to validate and implement fixes for them as well?

requirements/development.in

-testcontainers[cockroachdb,cratedb,db2,mongodb,mssql,mysql,oracle,postgres,trino]>=4.15.0,<5
+testcontainers[cockroachdb,cratedb,mongodb,mssql,mysql,oracle,postgres,trino]>=4.15.0,<5

MySqlContainer.get_connection_url() has no host override and defaults to
get_container_host_ip(), which returns the literal string "localhost" on
native Linux Docker (e.g. GitHub Actions runners). MySQLdb (mysqlclient)
treats a "localhost" host specially and attempts a Unix socket connection
instead of TCP, which fails since there's no local MySQL socket -- the
container is only reachable over the network. Confirmed on a real GHA
run: "Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock'".

This was never caught locally because of the separate, unrelated
mysqlclient linking issue on this dev machine, which crashed before ever
reaching a real connection attempt.
Superset Dev added 2 commits August 27, 2026 23:01
create_all() defaults to checkfirst=True, silently skipping creation (and
leaving old rows behind) if the table already exists from a prior run,
which collided with the fresh id=0-9 insert on primary key for mariadb.
…t's id column

A single-column integer primary key implicitly becomes AUTO_INCREMENT on
MySQL/MariaDB. That column type treats an explicit 0 as NULL by default,
so inserting id=0 got silently reassigned to 1, colliding with the
explicit id=1 row in the same batch insert -- reproduced locally against
a real mariadb:11 container and confirmed fixed with autoincrement=False.

Supersedes the previous (incorrect) guess that a leftover table from an
earlier run was the cause.
Comment thread requirements/development.in Resolved
rusackas and others added 2 commits August 28, 2026 02:35
… mariadb host, mongodb pagination test, weak type assertions, monetdb readiness, and CI path coverage

- drop `db2` from the `testcontainers[...]` extra in development.in/.txt:
  it transitively pulls `ibm-db-sa`/`ibm-db` into the baseline dev lockfile,
  which has no Linux arm64 wheel and breaks the multi-platform dev Docker
  image build; the db2 CI leg already installs it on demand separately.
- mariadb: preserve a remote Docker daemon's real host, only rewrite the
  literal "localhost" case to 127.0.0.1.
- testcontainers.yml: widen pull_request paths to superset/db_engine_specs/**,
  pyproject.toml, and the requirements manifests so a driver/lockfile-only
  change can't bypass this coverage.
- mongodb: use Core `select(...).limit().offset()` instead of a literal SQL
  string, so the pagination test actually exercises the dialect's own
  compilation.
- monetdb/mongodb/yugabytedb: assert generic_type/sqla_type on the mapped
  column spec, not just that a spec was returned.
- monetdb: wait for the exposed port (not just a log line that predates
  `monetdbd start -n`) before considering the container ready.
- timescaledb: pin the image to a specific tag instead of the mutable
  `latest-pg16`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ng global compiler state

sqlalchemy-monetdb mutates SQLAlchemy's shared, process-global
compiler.OPERATORS mapping in place on import instead of subclassing it
(OPERATORS = compiler.OPERATORS; OPERATORS[operators.ne] = " <> "). Once
Superset's own get_available_engine_specs() enumerates the "monetdb"
sqlalchemy.dialects entry point to build the "available databases" list
(which happens on every app boot, not just when MonetDB is actually
used), that changes `!=` rendering to `<>` for every dialect for the
rest of the process -- breaking test_where_operators identically across
the test-mysql/test-postgres/test-sqlite CI jobs, since installing the
monetdb extra now pulls sqlalchemy-monetdb into their shared dev
requirements.

Snapshot/restore sqlalchemy.sql.compiler.OPERATORS around each
third-party dialect entry point load so a misbehaving connector can't
leak global compiler state just because it was enumerated here.

Also fix the new mongodb testcontainers pagination test: pymongosql's
SQL-to-Mongo AST parser reads LIMIT/OFFSET off the compiled SQL text
ahead of parameter substitution, so a bound `LIMIT ?`/`OFFSET ?`
placeholder is silently dropped. Compile with literal_binds=True instead,
matching how Superset actually issues chart/SQL Lab queries.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Comment thread pyproject.toml Resolved
…test

text() has no static column metadata of its own -- the row's key comes
entirely from whatever pymongosql's DBAPI cursor reports for the raw
compiled SQL string, which turned out to be the qualified
"pilot_pagination.id" (matching the SELECT list's column reference), not
the bare "id" that attribute access expected. Reproduced by compiling the
exact statement offline and inspecting text()'s (empty) column metadata;
confirmed the AttributeError on real CI runs of this branch and #43640.
@netlify

netlify Bot commented Aug 28, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4028ff1
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a91c7958e4a2000083e2de7
😎 Deploy Preview https://deploy-preview-43640--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.

…ion test

The previous fix (positional row access) only masked the symptom.
Root cause: SQLAlchemy always qualifies a Table-bound column as
"pilot_pagination.id" once there's a FROM clause, but pymongosql's
projection builder takes that qualified text completely literally as a
MongoDB field path -- {"pilot_pagination.id": 1} reads a *nested* field
under a top-level "pilot_pagination" key, which doesn't exist on these
flat documents, silently projecting None for every row instead of
raising (confirmed via pymongosql/sql/query_handler.py's
_extract_field_and_alias, which uses the raw expression text verbatim
as the Mongo field key regardless of any AS alias).

A bare column()/table() pair (not bound to each other via a real Table
object) compiles to an unqualified "id" reference, which resolves
correctly, while still exercising the dialect's own LIMIT/OFFSET
compilation through a real Core select() -- this test's actual intent.
rusackas pushed a commit that referenced this pull request Aug 29, 2026
…test

text() has no static column metadata of its own -- the row's key comes
entirely from whatever pymongosql's DBAPI cursor reports for the raw
compiled SQL string, which turned out to be the qualified
"pilot_pagination.id" (matching the SELECT list's column reference), not
the bare "id" that attribute access expected. Reproduced by compiling the
exact statement offline and inspecting text()'s (empty) column metadata;
confirmed the AttributeError on real CI runs of this branch and #43640.
…se, starrocks (#43652)

Co-authored-by: Superset Dev <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
@rusackas
rusackas merged commit de7faa6 into feat/testcontainers-nightly-pilot Aug 30, 2026
70 checks passed
@rusackas
rusackas deleted the feat/testcontainers-more-dialects branch August 30, 2026 18:23
rusackas added a commit that referenced this pull request Sep 3, 2026
…abytedb, monetdb, mongodb (#43640)

Co-authored-by: Superset Dev <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
rusackas added a commit that referenced this pull request Sep 4, 2026
…abytedb, monetdb, mongodb (#43640)

Co-authored-by: Superset Dev <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
rusackas added a commit that referenced this pull request Sep 6, 2026
…abytedb, monetdb, mongodb (#43640)

Co-authored-by: Superset Dev <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
rusackas added a commit that referenced this pull request Sep 9, 2026
…abytedb, monetdb, mongodb (#43640)

Co-authored-by: Superset Dev <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:connect:mariadb Related to a specific database data:connect:timscaledb dependencies:python github_actions Pull requests that update GitHub Actions code install:dependencies Installation - Dependencies preset-io size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants