Last active
May 1, 2024 19:21
-
-
Save fb64/187491f7c0b55a6dac6530ba208f6b5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description": "DuckDB integration with Kotlin Dataframe", | |
"properties": [ | |
{ | |
"name": "duckdb-version", | |
"value": "0.10.2" | |
}, | |
{ | |
"name": "duckdb-database", | |
"value": "" | |
}, | |
{ | |
"name": "arrow-version", | |
"value": "16.0.0" | |
}, | |
{ | |
"name": "duckdb-renovate-hint", | |
"value": "update: package=org.duckdb:duckdb_jdbc" | |
} | |
], | |
"dependencies": [ | |
"org.duckdb:duckdb_jdbc:$duckdb-version", | |
"org.apache.arrow:arrow-c-data:$arrow-version", | |
"org.apache.arrow:arrow-memory-unsafe:$arrow-version" | |
], | |
"imports": [ | |
"org.duckdb.DuckDBConnection", | |
"org.duckdb.DuckDBResultSet", | |
"java.sql.DriverManager", | |
"java.sql.Statement", | |
"org.apache.arrow.memory.RootAllocator", | |
"org.apache.arrow.vector.ipc.ArrowReader" | |
], | |
"init": [ | |
"%use dataframe(\"0.14.0-dev-3035\")", | |
"fun DuckDBConnection.queryForDataFrame(query: String):AnyFrame{\r\nthis.createStatement().use {\r\nval duckDbResult = it.executeQuery(query) as DuckDBResultSet\r\nval arrowReader = duckDbResult.arrowExportStream(RootAllocator(),512) as ArrowReader\r\nreturn DataFrame.readArrow(arrowReader)\r\n}\r\n}", | |
"val duckdbConnection = DriverManager.getConnection(\"jdbc:duckdb:$duckdb-database\") as DuckDBConnection" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment