Editing many rows without endangering production
PhpStorm's Data Editor can do far more than change single cell values: multi-row selection, CSV import and export, and a built-in transaction mode make it a real bulk operations tool, one that deserves extra caution on remote connections to production databases.
Table of Contents
- 1. What the Data Editor offers that a plain SQL window does not
- 2. Editing multiple rows at once
- 3. Importing CSV data without writing INSERT statements
- 4. Exporting results as CSV for reports and hand-offs
- 5. Caution with changes over remote connections to production databases
- 6. Transaction mode and preview before the actual commit
- 7. Typical use case: maintaining EAV attributes in Magento
- 8. Using grid filters and sorting deliberately for bulk operations
- 9. A recommended workflow for safe bulk operations
- 10. Summary
- 11. FAQ
1. What the Data Editor offers that a plain SQL window does not
The Data Editor in PhpStorm shows table contents as an editable grid and allows direct changes without writing an UPDATE statement by hand every time. That is convenient for individual corrections, but the real value shows up during bulk operations: selecting several rows at once, applying the same value to a column, or importing entire datasets via CSV.
A plain SQL console window forces every change into an explicit statement, which quickly becomes cumbersome for repetitive corrections across many rows. The Data Editor instead generates the underlying SQL commands in the background and shows them in a preview panel before execution, so the actual change can still be reviewed before it is committed. For developers who switch daily between data maintenance and code work, this removes the constant context switch between an external database GUI and the actual IDE, noticeably speeding up the workflow.
2. Editing multiple rows at once
To change several rows at once, select them with Shift or Ctrl held down in the grid, then enter a new value in the selected column. PhpStorm applies this value to all selected rows and shows the number of affected rows in the status bar before the change is actually applied.
This is especially handy for typical Magento maintenance tasks, such as resetting an attribute value for several products in the catalog_product_entity_int table, or deactivating several customer accounts at once. Importantly, changes first stay local in the editor buffer, marked with an orange highlight, and are only sent to the database with Ctrl+Enter or the submit button.
-- The Data Editor generates roughly this in the background:
UPDATE catalog_product_entity_int
SET value = 0
WHERE entity_id IN (1024, 1025, 1026, 1030)
AND attribute_id = 96;
3. Importing CSV data without writing INSERT statements
The context menu of a table in the Database tool window offers Import Data from File, which reads CSV, TSV, or JSON files directly into an existing or new table. The import wizard automatically detects the column mapping from the header row and lets you manually map or skip individual columns.
For Magento projects this is especially useful for loading test data, such as a list of test customers for a staging environment. The wizard shows a preview of the first rows before the actual import and flags data type conflicts, for example when a column is meant to be imported as text but the target table expects an integer. You can also specify whether existing rows with the same primary key should be overwritten, skipped, or rejected as duplicates, which matters especially when reloading the same test file repeatedly during development.
# CSV format expected by the import wizard
email,firstname,lastname,group_id
test.kunde1@example.com,Anna,Muster,1
test.kunde2@example.com,Bernd,Test,1
4. Exporting results as CSV for reports and hand-offs
The reverse path works just as well: any query result or a selected row range can be exported via the context menu and Export Data to CSV, JSON, or even SQL insert statements. This is handy for quickly handing a list of broken orders to a business team without spinning up a separate reporting tool.
The export configuration lets you set the delimiter, encoding, and whether column names are included as a header row. Exporting to SQL insert statements is especially useful for moving a small, reproducible dataset as seed data into another environment.
5. Caution with changes over remote connections to production databases
As soon as a data source in PhpStorm points to a production database, it should generally be set up as read-only. In the data source dialog, under Options, the Read-only checkbox blocks every write operation in the Data Editor, even if a cell is accidentally clicked and edited.
If an edit is genuinely necessary, the manual transaction mode is the safer route: the Auto-commit icon in the Data Editor toolbar disables automatic committing, so changes only become permanent after an explicit Commit. Until then they can be fully undone with Rollback at any time, which makes a real difference when a bulk change goes wrong. It is also worth creating a separate, restricted database user for production connections whose privileges are limited to read access from the start, so even a misconfigured data source cannot trigger a write operation.
6. Transaction mode and preview before the actual commit
Before a change is sent to the database, PhpStorm shows a complete preview of the generated SQL statements in the submit dialog. For bulk changes across many rows, it is worth actually reading this preview instead of dismissing it reflexively, since unintended side effects become visible here too, for instance when a filter condition matches more rows than expected.
You can also configure, under Database, Data Views, that every change requires explicit confirmation instead of saving automatically when leaving a cell. This setting costs a bit of everyday convenience, but reliably prevents accidental changes caused by a wrong tab switch.
-- Example preview in the submit dialog before commit
UPDATE customer_entity SET is_active = 0
WHERE entity_id IN (501, 502, 509);
-- 3 rows affected, transaction not yet committed
7. Typical use case: maintaining EAV attributes in Magento
Magento stores product attributes in the EAV model spread across several tables, which makes direct SQL changes error-prone if attribute_id and entity_type_id are not handled correctly. The Data Editor helps here, since you can first isolate the affected rows of a single EAV table through a filter before making a bulk change.
As a rule though, for recurring EAV changes an indexer-safe path through Magento's own repositories or a CLI command is always preferable, since the Data Editor triggers no cache invalidation and no indexer events. Direct SQL changes to EAV tables should therefore always be followed by a manual reindex.
8. Using grid filters and sorting deliberately for bulk operations
Before starting a bulk change, it is worth narrowing the affected row set via the filter row in the grid or via a preceding WHERE clause in query console mode. The Data Editor shows the number of currently visible rows in the status bar, allowing a quick sanity check before the actual change.
For more complex filter conditions that cannot be expressed through the simple filter row, switch to SQL filter mode, where any WHERE condition can be entered as text. This mode acts as a pre-filter for the grid without leaving the result window of the underlying query.
9. A recommended workflow for safe bulk operations
A safe workflow always starts with a plain SELECT query that returns exactly the row set to be changed later. Only once that query shows the expected number of rows do you switch to editing in the grid, enable manual commit mode for critical data sources, and check the generated SQL preview before the actual submit.
For recurring bulk operations, such as monthly data cleanups, a documented SQL script pays off in the long run over manual grid editing, since scripts are versionable and traceable. The Data Editor still remains the right tool for ad hoc corrections and quick visual checks of data during development.
| Operation | Tool in the Data Editor | Risk on production data | Safeguard |
|---|---|---|---|
| Editing a single cell | Direct edit in the grid | Low | Read-only flag on production sources |
| Editing a multi-row selection | Shift/Ctrl multi-selection | Medium to high | Manual commit mode, check the SQL preview |
| CSV import | Import Data from File | High on wrong mapping | Check preview rows and data types |
| CSV export | Export Data | Low, but mind data privacy | Check export scope and destination |
Mironsoft
PhpStorm setup, Docker integration, and team productivity
PhpStorm that actually runs optimally for Magento and PHP projects?
We review existing PhpStorm setups for slow indexing, unused Docker integration, and missing team conventions, then set up a configuration that is productive from the first second.
Setup Review
Optimizing indexing, interpreter, and memory settings for large Magento projects.
Docker Integration
Cleanly connecting Xdebug, PHPUnit, and database tools to the Docker setup.
Team Conventions
Standardizing inspection profiles, code style, and live templates project-wide.
10. Summary
Data Editor Bulk Operations: The Essentials at a Glance
Core feature
Multi-row selection in the grid applies one value to any number of selected rows at once.
Import/export
CSV, TSV, and JSON can be imported and exported directly via the context menu.
Most important safeguard
Mark production data sources as read-only, otherwise use manual commit mode.
Magento specific
EAV changes via the Data Editor trigger no reindex, a manual reindex is mandatory.