Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
142c0eb
Refactored DataFrame JDBC API for enhanced DataSource handling
zaleslaw Oct 9, 2025
de3a97a
Refactored schema extraction to use `readSqlTable` and `readSqlQuery`…
zaleslaw Oct 9, 2025
477da67
Refactored and modularized schema extraction utilities into a dedicat…
zaleslaw Oct 9, 2025
448eab6
Refactor: Replace `DataFrame` with `DataFrameSchema` for schema-relat…
zaleslaw Oct 10, 2025
e02a6be
Update logging levels in validation utilities to debug and minor sche…
zaleslaw Oct 10, 2025
7f66bf4
Refactor: support custom `PreparedStatement` configuration, unify que…
zaleslaw Oct 10, 2025
b53e9f1
Refactor: enhance `DbType` with batch size and query timeout properti…
zaleslaw Oct 13, 2025
08d927e
Refactor: centralize `makeCommonSqlToKTypeMapping` in `DbType`, strea…
zaleslaw Oct 13, 2025
9f75a84
Refactored query execution logic by introducing `readDataFrameFromDat…
zaleslaw Oct 14, 2025
565e969
Refactored ResultSet-processing utilities to use mutable lists for im…
zaleslaw Oct 14, 2025
cc8c861
Add `configureStatement` missed parameters
zaleslaw Oct 14, 2025
ecbbe53
Refactored JDBC utilities: added comprehensive error handling in `rea…
zaleslaw Oct 14, 2025
3310382
Update the exception type in the ` read from non-existing table` test…
zaleslaw Oct 14, 2025
23f7c1b
Renamed schema extraction functions from `getSchemaFor*` to `from*` f…
zaleslaw Oct 14, 2025
3377e98
Rename `fromSqlTable` and `fromSqlQuery` to `readSqlTable` and `readS…
zaleslaw Oct 14, 2025
e4e84c2
Update `GenerateDataSchemaTask` to use `DataFrameSchema` methods for …
zaleslaw Oct 14, 2025
3aea719
Refactor: improve code consistency, update parameter documentation, s…
zaleslaw Oct 15, 2025
5489889
Replace `DEFAULT_LIMIT` with nullable `limit` parameter, defaulting t…
zaleslaw Oct 16, 2025
328c46f
Add `validateLimit` utility to ensure limit parameter is null or posi…
zaleslaw Oct 16, 2025
e007fa5
Add `validateLimit` calls across all JDBC read methods to enforce lim…
zaleslaw Oct 16, 2025
56d93f5
Clarify "limit" parameter documentation and rename `readDataFrameFrom…
zaleslaw Oct 16, 2025
f0e4d69
Refactor JDBC data handling: relocate and centralize `buildSchemaByTa…
zaleslaw Oct 16, 2025
6f2e2de
Ktlint with Junie
zaleslaw Oct 16, 2025
1c772a2
Linter with Junie, part 2
zaleslaw Oct 16, 2025
7009a61
Refactor and enhance JDBC: update references for improved consistency…
zaleslaw Oct 16, 2025
f928057
Add `DataFrameSchema.Companion` class to core API
zaleslaw Oct 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -6808,11 +6808,15 @@ public final class org/jetbrains/kotlinx/dataframe/schema/ComparisonMode : java/
}

public abstract interface class org/jetbrains/kotlinx/dataframe/schema/DataFrameSchema {
public static final field Companion Lorg/jetbrains/kotlinx/dataframe/schema/DataFrameSchema$Companion;
public abstract fun compare (Lorg/jetbrains/kotlinx/dataframe/schema/DataFrameSchema;Lorg/jetbrains/kotlinx/dataframe/schema/ComparisonMode;)Lorg/jetbrains/kotlinx/dataframe/schema/CompareResult;
public static synthetic fun compare$default (Lorg/jetbrains/kotlinx/dataframe/schema/DataFrameSchema;Lorg/jetbrains/kotlinx/dataframe/schema/DataFrameSchema;Lorg/jetbrains/kotlinx/dataframe/schema/ComparisonMode;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/schema/CompareResult;
public abstract fun getColumns ()Ljava/util/Map;
}

public final class org/jetbrains/kotlinx/dataframe/schema/DataFrameSchema$Companion {
}

public final class org/jetbrains/kotlinx/dataframe/util/DeprecationMessagesKt {
public static final field DF_READ_EXCEL Ljava/lang/String;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jetbrains.kotlinx.dataframe.schema

public interface DataFrameSchema {
public companion object;

public val columns: Map<String, ColumnSchema>

Expand Down
254 changes: 136 additions & 118 deletions dataframe-jdbc/api/dataframe-jdbc.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package org.jetbrains.kotlinx.dataframe.io

/**
* Represents the configuration for an internally managed JDBC database connection.
*
* This class defines connection parameters used by the library to create a `Connection`
* when the user does not provide one explicitly.
* It is designed for safe, read-only access by default.
*
* __NOTE:__ Connections created using this configuration are managed entirely by the library.
* Users do not have access to the underlying `Connection` instance and cannot commit or close it manually.
*
* ### Read-Only Mode Behavior:
*
* When [readOnly] is `true` (default), the connection operates in read-only mode with:
* - `Connection.setReadOnly(true)`
* - `Connection.setAutoCommit(false)`
* - automatic `rollback()` at the end of execution
*
* When [readOnly] is `false`, the connection uses JDBC defaults (usually read-write),
* but the library still rejects any queries that appear to modify data
* (e.g. contain `INSERT`, `UPDATE`, `DELETE`, etc.).
*
* ### Examples:
*
* ```kotlin
* // Safe read-only connection (default)
* val config = DbConnectionConfig("jdbc:sqlite::memory:")
* val df = DataFrame.readSqlQuery(config, "SELECT * FROM books")
*
* // Use default JDBC connection settings (still protected against mutations)
* val config = DbConnectionConfig(
* url = "jdbc:sqlite::memory:",
* readOnly = false
* )
* ```
*
* @property [url] The JDBC URL of the database, e.g., `"jdbc:postgresql://localhost:5432/mydb"`.
* Must follow the standard format: `jdbc:subprotocol:subname`.
*
* @property [user] The username used for authentication.
* Optional, default is an empty string.
*
* @property [password] The password used for authentication.
* Optional, default is an empty string.
*
* @property [readOnly] If `true` (default), enables read-only mode. If `false`, uses JDBC defaults
* but still prevents data-modifying queries. See class documentation for details.
*/
public class DbConnectionConfig(
public val url: String,
public val user: String = "",
public val password: String = "",
public val readOnly: Boolean = true,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is DbConnectionConfig) return false

if (url != other.url) return false
if (user != other.user) return false
if (password != other.password) return false
if (readOnly != other.readOnly) return false

return true
}

override fun hashCode(): Int {
var result = url.hashCode()
result = 31 * result + user.hashCode()
result = 31 * result + password.hashCode()
result = 31 * result + readOnly.hashCode()
return result
}

override fun toString(): String = "DbConnectionConfig(url='$url', user='$user', password='***', readOnly=$readOnly)"

/**
* Creates a copy of this configuration with the option to override specific properties.
*
* @param url The JDBC URL. If not specified, uses the current value.
* @param user The username. If not specified, uses the current value.
* @param password The password. If not specified, uses the current value.
* @param readOnly The read-only flag. If not specified, uses the current value.
* @return A new [DbConnectionConfig] instance with the specified changes.
*/
public fun copy(
url: String = this.url,
user: String = this.user,
password: String = this.password,
readOnly: Boolean = this.readOnly,
): DbConnectionConfig = DbConnectionConfig(url, user, password, readOnly)
}
Loading