feat(jdbc): JdbcExporter, matching the CSV and Parquet exporters
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start by comparing the existing JdbcImporter and JdbcImportOptions with the CSV and Parquet exporter APIs to locate the JDBC module’s conventions. Then review the import type mapping and exporter progress listener patterns before defining the export API and binder behavior. Done means exporting rows into a caller-provided table in batches with validity-aware nulls, transaction rollback on failure, restored auto-commit, and opt-in DDL support.
由索引模型根據 Issue 內容生成。
描述
vortex-jdbc only has JdbcImporter/JdbcImportOptions; csv and parquet each have an importer and an exporter. Add JdbcExporter + JdbcExportOptions for symmetry: read a Vortex file and move its rows into a table in a JDBC database over a caller-supplied Connection.
API sketch
JdbcExportOptions opts = JdbcExportOptions.defaults()
.withBatchSize(5_000)
.withBinder(JdbcBinder.standard()
.with(DType.Extension.class, (ps, i, value) -> ps.setObject(i, value)));
JdbcExporter.export(vortexPath, connection, "ohlc", opts);
- Options are a final class with a private constructor,
defaults()andwithXxxcopies, as everywhere else. The target table is a required argument ofexport, not an option (confirm thatCsvExporter/ParquetExportertake their target the same way). - Binder (callback): a small functional interface that sets one value on a
PreparedStatement.JdbcBinder.standard()covers primitives, strings, decimals, booleans and dates. A user overrides only the types their database needs special handling for (Postgres arrays,setObjectfor timestamps). - DDL helper, not automatic: a
DTypeto SQL type function pluscreateTableSql(name, dtype)returns aCREATE TABLEstring. The exporter never creates or alters a table on its own; creation is opt-in.
Behavior
- Appends to an existing table with
INSERT INTO t (cols...) VALUES (?, ...)through aPreparedStatement. Nulls follow the validity mask. - One transaction for the whole export: remember the connection's auto-commit setting,
setAutoCommit(false),addBatch()per row,executeBatch()everybatchSizerows,commit()at the end,rollback()and rethrow on failure, and restore auto-commit in afinally. The connection belongs to the caller. A failed export leaves nothing behind. ProgressListener, as in the other exporters.
Open design questions
- Reverse type mapping
DTypeto SQL type (the inverse ofSqlTypeToDType); it varies by database. - Create-if-missing vs truncate vs fail-if-exists: all opt-in, append is the default.
- A
withCommitEvery(n)option for very large exports, if a long-lived transaction proves a problem. Not in the first cut.
Not needed for the jdbc:vortex: driver work (#566). No demand yet, so this waits until someone needs it.
- 主要語言
- Java
- 星號
- 3
- 分支
- 2
- 平均合併
- 14 小時 59 分鐘
- 30 天內合併 PR
- 137
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
dfa1/vortex-java 的其他 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 66/100
dfa1/vortex-java#636 ·
維護者通常 1 天內回覆
-
bug
難度 4/5 3-5 天 新手友好度 35/100
dfa1/vortex-java#634 ·
維護者通常 1 天內回覆
-
enhancement
難度 4/5 3-5 天 新手友好度 55/100
dfa1/vortex-java#601 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 30/100
dfa1/vortex-java#583 ·
維護者通常 1 天內回覆
-
enhancement
難度 4/5 3-5 天 新手友好度 45/100
dfa1/vortex-java#548 ·
維護者通常 1 天內回覆
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 3 天內回覆
-
A proxy that fails to start logs a RejectedExecutionException stack trace from its shutdown hook未關閉follow-up
難度 2/5 1-3 小時 新手友好度 62/100
Sanne/incus-spawn#1953 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
atlassian/data-center-helm-charts#1170 ·
維護者通常 1 天內回覆
-
Bug
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
Issue: Bug
難度 2/5 1-3 小時 新手友好度 62/100
OpenAPITools/openapi-generator#25524 ·
維護者通常 1 天內回覆