You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "nzw921rx (via GitHub)" <gi...@apache.org> on 2026/06/16 05:00:12 UTC

[PR] Optionrule/jdbc [seatunnel]

nzw921rx opened a new pull request, #11106:
URL: https://github.com/apache/seatunnel/pull/11106

   ### Purpose of this pull request
   
   Related: https://github.com/apache/seatunnel/issues/11007
   
   Migrate JDBC connector validation from imperative `if/throw` checks to declarative `OptionRule` + `Conditions.extension()`, covering Source, Sink, and all 15 Catalog factories.
   
   **Changes**:
   - `JdbcSourceFactory` — add declarative rules: `required(URL, DRIVER)`, `TableListExclusiveValidator` (rejects `table_list` coexisting with `table_path`/`query`), `WhereConditionPrefixValidator` (requires `where` prefix)
   - `JdbcSinkFactory` — add declarative rules: `required(URL, DRIVER, SCHEMA_SAVE_MODE, DATA_SAVE_MODE)`, `OracleAppendValuesValidator` (rejects conflicts with exactly-once, copy statement, auto_commit=false, custom query, insert-only upsert), `ExactlyOnceMaxRetriesValidator` (requires `max_retries=0`), conditional groups for exactly-once, generate_sink_sql, custom save mode
   - `JdbcCommonOptions` — add `baseCatalogRule()` with `UrlContainsDatabaseValidator` to replace per-catalog `Preconditions.checkArgument` / `OptionValidationException` checks; deprecate shared mutable `BASE_CATALOG_RULE` field
   - 13 Catalog factories (MySQL, Postgres, Oracle, SqlServer, Dameng, Iris, Kingbase, HighGo, OpenGauss, SapHana, TiDB, Xugu, Redshift) — remove imperative URL/database validation from `createCatalog()`
   - `OceanBaseCatalogFactory` — extend `baseCatalogRule()` with additional `.required(COMPATIBLE_MODE)`
   - `JdbcSourceConfig` — remove imperative `where_condition` prefix check (now in factory OptionRule)
   - `JdbcSourceTableConfig` — remove redundant `table_list` exclusive check (now in factory OptionRule)
   - `JdbcOutputFormatBuilder` — remove Oracle APPEND_VALUES runtime checks for custom query, auto_commit, exactly-once, copy statement (moved to factory OptionRule); keep runtime-only checks for dialect name and primary keys
   - `JdbcOutputFormatBuilderTest` — remove 3 obsolete runtime tests now covered by `JdbcSinkFactoryTest`
   - Add `JdbcSourceFactoryTest` (11 cases), `JdbcSinkFactoryTest` (11 cases), `JdbcCatalogFactoryTest` (8 cases) for declarative validation coverage
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, minor improvements:
   
   1. Validation errors are now aggregated and returned together instead of failing on the first error
   2. Better validation descriptions available via REST API and CLI metadata export
   
   ### How was this patch tested?
   
   ```bash
   ./mvnw test -pl seatunnel-connectors-v2/connector-jdbc \
     -Dtest="JdbcSourceFactoryTest,JdbcSinkFactoryTest,JdbcCatalogFactoryTest,JdbcFactoryTest"
   
   ./mvnw test -pl seatunnel-connectors-v2/connector-jdbc
   ```
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate jdbc validation to declarative OptionRule [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #11106:
URL: https://github.com/apache/seatunnel/pull/11106


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org