Skip to content

feat: Oracle 18c/19c support (soda-core dialect capability + test infra)#2795

Merged
paulteehan merged 5 commits into
mainfrom
r-606-oracle-19-support
Jul 20, 2026
Merged

feat: Oracle 18c/19c support (soda-core dialect capability + test infra)#2795
paulteehan merged 5 commits into
mainfrom
r-606-oracle-19-support

Conversation

@Niels-b

@Niels-b Niels-b commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Oracle 18c/19c support — soda-core side

Part of cross-repo Oracle 18c/19c support. This PR carries the soda-core-side dialect capability and test infrastructure; the Oracle dialect/adapter changes live in the paired soda-extensions PR on the matching r-606-oracle-19-support branch.

Why

Oracle < 23ai lacks several SQL features that 23ai added (native BOOLEAN, multi-row VALUES, IF [NOT] EXISTS, FROM-less SELECT, ...). Supporting Oracle 18c/19c requires a small, additive capability hook in the core dialect plus version-aware test helpers.

Changes (additive; non-Oracle behavior unchanged)

  • SqlDialect.supports_native_boolean() — default True. Data sources whose BOOLEAN cannot round-trip (Oracle < 23ai stores it as NUMBER, indistinguishable from other numerics on read-back) override to False.
  • DataSourceTestHelper.select_literal_query() — portable "select a literal" query for tests (Oracle appends FROM DUAL); get_column_mappings() expects NUMERIC for the boolean column when the source has no native boolean.
  • TestConnection health-check probe moved into the helper (_connection_test_query) instead of a raw FROM-less SELECT 1.
  • Tests: data-type and rows_tested tests made capability/version-aware; added an Oracle-gated schema-check test asserting a data_type: boolean contract passes.

Validation

Validated against Postgres, Oracle 23ai, and Oracle 18c (18c is a proxy for 19c — same 12.2 kernel family): integration suite, DWH (both transfer modes), and connection/schema/rows_tested tests — all green, no regressions on non-Oracle sources.

🤖 Generated with Claude Code

Niels-b and others added 2 commits July 15, 2026 17:50
…probes

Supporting changes for Oracle 18c/19c compatibility (soda-core side):

- SqlDialect.supports_native_boolean() (default True). Data sources whose
  BOOLEAN cannot round-trip -- Oracle < 23ai stores it as NUMBER, which is
  indistinguishable from other numerics on read-back -- override to False.
- DataSourceTestHelper.select_literal_query() for portable constant
  SELECTs (Oracle appends FROM DUAL).
- TestConnection health-check probe moved into the helper
  (_connection_test_query) instead of a raw FROM-less "SELECT 1".
- Data-type and rows_tested tests made capability/version aware.

Behavior for all non-Oracle data sources is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add an Oracle-gated schema-check test asserting a `data_type: boolean`
  contract passes (pre-23ai stores BOOLEAN as NUMBER; 23ai native).
- Route the rows_tested_query `SELECT NULL` case through select_literal_query
  (adds FROM DUAL on Oracle), consistent with the other constant queries.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Niels-b
Niels-b force-pushed the r-606-oracle-19-support branch from 48bd831 to 1503baa Compare July 15, 2026 15:51
Niels-b and others added 2 commits July 15, 2026 18:08
…call)

- test_schema_check.py: use a plain string (not an f-string) for the boolean
  schema-check contract; it has no replacement fields.
- test_connection.py: hoist the connection-probe query into a variable so only
  execute_query can throw inside the pytest.raises block.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`valid_values: []` / `invalid_values: []` produced a bare boolean literal
(AND([LITERAL(True/False)])) used in predicate position. That is valid on
sources with a native boolean (Postgres, Oracle 23ai) but not on those without
one — on pre-23ai Oracle it renders as `CASE WHEN 1 ...` and raises ORA-00920.

Emit a portable always-true / always-false comparison (`1 = 1` / `1 = 0`)
instead, which is semantically identical and valid on every dialect. No
recorded snapshot exercises this edge case, so existing sources are unaffected.

Adds two rendering regression tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@paulteehan paulteehan 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.

Minor thing that confused me a bit, up to you

see also the requested changes in the other PR, I didn't check if they have interactions here at all, I don't think so? maybe double-check

Comment thread soda-tests/src/helpers/test_connection.py Outdated
…fy literal-select

Review follow-ups (#2795):

- supports_native_boolean() was only ever consumed by test code, so move it off the
  production SqlDialect onto DataSourceTestHelper (base returns True; the Oracle test
  helper overrides it). The production dialect keeps its single version gate
  (OracleSqlDialect._is_pre_23ai). Callers in the test helper and test_soda_data_types
  updated accordingly.
- Add DataSourceTestHelper.build_select_literal_query(type, expr) as the single source
  of truth for a literal SELECT (Oracle needs FROM DUAL; others accept a bare SELECT).
  select_literal_query delegates to it and TestConnection._connection_test_query reuses
  it instead of its own hardcoded Oracle branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@paulteehan
paulteehan merged commit 60f0b8f into main Jul 20, 2026
21 of 22 checks passed
@paulteehan
paulteehan deleted the r-606-oracle-19-support branch July 20, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants