Skip to content

Commit 65ce2ea

Browse files
authored
Implemented custom SQL DB registration (#917)
* 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
1 parent 439f65d commit 65ce2ea

File tree

3 files changed

+249
-73
lines changed
  • dataframe-jdbc/src

3 files changed

+249
-73
lines changed

dataframe-jdbc/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/db/H2.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import kotlin.reflect.KType
1515
*
1616
* NOTE: All date and timestamp-related types are converted to String to avoid java.sql.* types.
1717
*/
18-
public class H2(public val dialect: DbType = MySql) : DbType("h2") {
18+
public open class H2(public val dialect: DbType = MySql) : DbType("h2") {
1919
init {
2020
require(dialect::class != H2::class) { "H2 database could not be specified with H2 dialect!" }
2121
}

0 commit comments

Comments
 (0)