You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(jdbc): JdbcExporter, matching the CSV and Parquet exporters #567
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.
Options are a final class with a private constructor, defaults() and withXxx copies, as everywhere else. The target table is a required argument of export, not an option (confirm that CsvExporter/ParquetExporter take 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, setObject for timestamps).
DDL helper, not automatic: a DType to SQL type function plus createTableSql(name, dtype) returns a CREATE TABLE string. 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 a PreparedStatement. Nulls follow the validity mask.
One transaction for the whole export: remember the connection's auto-commit setting, setAutoCommit(false), addBatch() per row, executeBatch() every batchSize rows, commit() at the end, rollback() and rethrow on failure, and restore auto-commit in a finally. The connection belongs to the caller. A failed export leaves nothing behind.
ProgressListener, as in the other exporters.
Open design questions
Reverse type mapping DType to SQL type (the inverse of SqlTypeToDType); 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.
Activity