Skip to content

Commit 61d2e8d

Browse files
committed
WIP: Add doc, add revisit part in tests
1 parent f5900d3 commit 61d2e8d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

datajoint/table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def delete(
486486
transaction: bool = True,
487487
safemode: Union[bool, None] = None,
488488
force_parts: bool = False,
489-
include_parts: bool = True,
489+
force_masters: bool = True,
490490
) -> int:
491491
"""
492492
Deletes the contents of the table and its dependent tables, recursively.

docs/src/manipulation/delete.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ consequence of deleting the master table.
2727

2828
To enforce this workflow, calling `delete` directly on a part table produces an error.
2929
In some cases, it may be necessary to override this behavior.
30-
To remove entities from a part table without calling `delete` master, use the argument `force=True`.
30+
To remove entities from a part table without calling `delete` master, use the argument `force_parts=True`.
31+
To include the correponding entries in the master table, use the argument `force_masters=True`.

tests/schema_simple.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,18 @@ class H(dj.Part):
125125
id_h :int
126126
"""
127127

128+
class I(dj.Part):
129+
definition = """ # test force_masters revisit part
130+
-> E
131+
id_i :int
132+
---
133+
-> H
134+
"""
135+
128136
def make(self, key):
129137
random.seed(str(key))
130138
l_contents = list(L().fetch("KEY"))
131-
part_f, part_g, part_h = E.F(), E.G(), E.H()
139+
part_f, part_g, part_h, part_i = E.F(), E.G(), E.H(), E.I()
132140
bc_references = list((B.C() & key).fetch("KEY"))
133141
random.shuffle(bc_references)
134142

@@ -141,6 +149,7 @@ def make(self, key):
141149
g_inserts = [dict(key, id_g=i, **ref) for i, ref in enumerate(l_contents)]
142150
part_g.insert(g_inserts)
143151
part_h.insert(dict(key, id_h=i) for i in range(4))
152+
part_i.insert(dict(key, id_i=i, **random.choice(g_inserts)) for i in range(4))
144153

145154

146155
class F(dj.Manual):

0 commit comments

Comments
 (0)