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
docs: replace dry_run with safemode workflow and Diagram.counts()
Remove references to the deleted dry_run parameter from delete()
and drop(). Document the built-in safemode safety workflow
(transaction + preview + confirmation + rollback) and
Diagram.cascade().counts() for programmatic preview.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/about/whats-new-22.md
+16-9Lines changed: 16 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -276,20 +276,27 @@ When a child has multiple restricted ancestors, convergence depends on the mode:
276
276
277
277
When a child references the same parent through multiple foreign keys (e.g., `source_mouse` and `target_mouse` both referencing `Mouse`), these paths always combine with OR regardless of the mode — each FK path is an independent reason for the child row to be affected.
278
278
279
-
### Dry Run
279
+
### Safe Delete Workflow
280
280
281
-
`Table.delete()` and `Table.drop()` accept a `dry_run` parameter that returns affected row counts without modifying data:
281
+
With `safemode=True` (the default), `delete()` provides a built-in preview-and-confirm workflow:
282
+
283
+
1. Builds the cascade diagram and computes all affected tables
284
+
2. Executes the deletes inside a transaction
285
+
3. Logs every affected table and its row count
286
+
4. Asks **"Commit deletes?"** — declining **rolls back** all changes
287
+
288
+
This is safer than a pre-transaction preview because it reflects the actual database state at delete time, including triggers and concurrent changes.
289
+
290
+
For programmatic preview without executing, use `Diagram` directly:
The `drop()` method follows the same safemode pattern — previewing affected tables and asking for confirmation before proceeding.
299
+
293
300
### Unloaded Schema Detection
294
301
295
302
If a descendant table lives in a schema that hasn't been activated, the graph-driven delete won't know about it. When the final `DELETE` fails with a foreign key error, DataJoint catches it and produces an actionable error message identifying which schema needs to be activated — rather than the opaque crash of the prior implementation.
@@ -326,7 +333,7 @@ The graph-driven approach resolves every known limitation of the prior error-dri
326
333
| Part integrity enforcement | Post-hoc check after delete | Data-driven post-check (no false positives) |
Cascade inspection via `dj.Diagram` was added in DataJoint 2.2.
196
196
197
-
For a quick preview, `table.delete(dry_run=True)`returns the affected row counts without deleting anything:
197
+
With `safemode=True` (the default), `delete()`provides a built-in safety workflow: it executes the cascade inside a transaction, shows all affected tables and row counts, and asks **"Commit deletes?"** before committing. Declining rolls back all changes.
For more complex scenarios — working across schemas, chaining multiple restrictions, or visualizing the dependency graph — use `dj.Diagram` to build and inspect the cascade explicitly:
199
+
For programmatic preview without executing, or for complex scenarios — working across schemas, chaining multiple restrictions, or visualizing the dependency graph — use `dj.Diagram` to build and inspect the cascade explicitly:
0 commit comments