Skip to content

Commit

Permalink
Implemented custom SQL DB registration (#917)
Browse files Browse the repository at this point in the history
* Add optional dbType parameter to JDBC read functions

This commit introduces an optional `dbType` parameter to various JDBC read functions. It allows for specifying the database type directly, enhancing flexibility and control over query execution. This change ensures backward compatibility by defaulting to type inference when `dbType` is not provided.

* Add support for custom DB types in schema generation

This update introduces the ability to specify custom database types in the data schema generation process. The changes include the addition of a `dbTypeClassName` field and modifications to pass `DbType` to relevant functions. This enhances flexibility in handling various database types beyond the default configurations.

* Refactor database type handling with ServiceLoader

This update refactors the DataSchemaGenerator to use ServiceLoader for loading DbTypeProvider and removes hard-coded class loading. It also changes the annotation parameter from dbTypeClassName to dbTypeKClass for better type safety.

* Reverted support custom DB for plugins

* Added tests for customDB for limited number of cases and API testing

* Add dbType parameter to readSqlTable function

* Update Javadoc to clarify automatic database type recognition
  • Loading branch information
zaleslaw authored Nov 6, 2024
1 parent 439f65d commit 65ce2ea
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import kotlin.reflect.KType
*
* NOTE: All date and timestamp-related types are converted to String to avoid java.sql.* types.
*/
public class H2(public val dialect: DbType = MySql) : DbType("h2") {
public open class H2(public val dialect: DbType = MySql) : DbType("h2") {
init {
require(dialect::class != H2::class) { "H2 database could not be specified with H2 dialect!" }
}
Expand Down
Loading

0 comments on commit 65ce2ea

Please sign in to comment.