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: export tables to CSV, JSON or SQL, and import CSV in one transaction - #20
Export a table to CSV, JSON, or SQL (INSERT statements in the connection's dialect). You choose where to save in a native dialog. Exports stop at 200,000 rows and say so if the table is bigger.
Import CSV, chosen in a native dialog, into a table:
Header names match the table's columns case-insensitively. Unknown or repeated columns, or rows with the wrong number of fields, are refused before anything is written.
Empty fields import as NULL.
All rows go in one transaction, as batched multi-row INSERTs, so a failure part-way leaves the table untouched.
Limits: 50 MB and 200,000 rows.
The CSV parser handles quoted fields, embedded commas, quotes and newlines, CRLF line endings and a BOM. The writers quote and escape per format.
Main only touches files the user picked in a native dialog, and the renderer never supplies a path.
Tests cover the CSV parser and writers, header mapping, batching, transaction rollback, limits, and the export/import handlers for both dialects. The features page is updated.
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
MySQL nontransactional tables break import atomicity
src/main/ipc/dbMysql.ts:103
A MySQL transaction does not provide the promised all-or-nothing import for nontransactional tables such as MyISAM: earlier batches remain inserted when a later batch fails and rollback() is ineffective. Check the target table's storage engine and reject imports unless it supports transactions, or use an import strategy that is atomic for that engine.
This map silently collapses PostgreSQL columns that differ only by case, which are legal when quoted (for example, Foo and foo). A CSV header can then be routed to whichever column appeared last and import data into the wrong column. Detect case-folding collisions and either prefer an exact-case match or reject an ambiguous header before inserting.
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Prevent non-transactional MySQL imports from claiming atomicity
src/main/ipc/dbMysql.ts:103
A transaction does not guarantee rollback for non-transactional MySQL/MariaDB table engines such as MyISAM (and some Aria configurations). If a later row or batch fails, earlier inserts remain even though rollback() is called, violating the advertised all-or-nothing import behavior. Check the target table engine and refuse imports when transactions are unsupported, or use an import strategy that guarantees atomicity.
Preserve PostgreSQL special floating-point values during export
src/main/ipc/dbTransfer.ts:147
This silently exports PostgreSQL's valid NaN, Infinity, and -Infinity floating-point values as SQL NULL, changing the data when the script is replayed. Emit PostgreSQL's accepted quoted special literals instead; MySQL need not receive these values because it does not support storing them as ordinary floating-point values.
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Add tests covering multi-batch imports and rollback
src/main/ipc/__tests__/database.test.ts:264
This test imports only two rows, and the MySQL test below does the same, so neither crosses the 60,000-bind-parameter batch boundary despite the PR description claiming batching coverage. A regression in second-batch placeholder numbering or rollback after an earlier batch would pass. Make the batch limit injectable for tests or construct an import that forces at least two batches and fails the latter.
Reject nontransactional engines to preserve atomic imports
src/main/ipc/dbMysql.ts:100
beginTransaction() does not make inserts atomic for nontransactional MySQL/MariaDB engines such as MyISAM or MEMORY; rollback is ignored and earlier batches remain written. This contradicts the all-or-nothing import contract for supported connections. Check the target table engine's transaction capability before inserting and reject unsupported tables (or explicitly narrow the feature contract).
Generate SQL literals compatible with NO_BACKSLASH_ESCAPES
src/main/ipc/dbTransfer.ts:146
This escaping depends on MySQL's default backslash mode. With the valid NO_BACKSLASH_ESCAPES SQL mode, an original value such as C:\temp is replayed with two backslashes, so the SQL export silently changes data. Emit mode-independent literals (for example, encoded hex text) or include an explicit compatible SQL mode in the script.
Preserve PostgreSQL special values and typed object serialization
src/main/ipc/dbTransfer.ts:177
This generic normalization loses valid PostgreSQL values. pg returns float NaN/Infinity as non-finite numbers, which become NULL, and object-valued types such as interval and point are JSON-stringified by plain() into text those columns cannot parse. The resulting SQL either corrupts data or cannot be replayed; preserve column type metadata and serialize/cast these values to PostgreSQL-compatible text.
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 9 of the parity roadmap.
INSERTstatements in the connection's dialect). You choose where to save in a native dialog. Exports stop at 200,000 rows and say so if the table is bigger.NULL.INSERTs, so a failure part-way leaves the table untouched.database.tsintodbPostgres.tsanddbMysql.ts(shared types indbTypes.ts), keeping the schema fixes from feat: edit, insert and delete database rows #18 and feat: ER diagram of tables and foreign keys #19.Tests cover the CSV parser and writers, header mapping, batching, transaction rollback, limits, and the export/import handlers for both dialects. The features page is updated.