Skip to content

Commit 53bd28d

Browse files
committed
Drop jobs table when auto-populated table is dropped
Override drop_quick() in Imported and Computed to also drop the associated jobs table when the main table is dropped.
1 parent 086de07 commit 53bd28d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/datajoint/user_tables.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ class Imported(UserTable, AutoPopulate):
152152
_prefix = "_"
153153
tier_regexp = r"(?P<imported>" + _prefix + _base_regexp + ")"
154154

155+
def drop_quick(self):
156+
"""
157+
Drop the table and its associated jobs table.
158+
"""
159+
# Drop the jobs table first if it exists
160+
if self._jobs_table is not None and self._jobs_table.is_declared:
161+
self._jobs_table.drop_quick()
162+
super().drop_quick()
163+
155164

156165
class Computed(UserTable, AutoPopulate):
157166
"""
@@ -162,6 +171,15 @@ class Computed(UserTable, AutoPopulate):
162171
_prefix = "__"
163172
tier_regexp = r"(?P<computed>" + _prefix + _base_regexp + ")"
164173

174+
def drop_quick(self):
175+
"""
176+
Drop the table and its associated jobs table.
177+
"""
178+
# Drop the jobs table first if it exists
179+
if self._jobs_table is not None and self._jobs_table.is_declared:
180+
self._jobs_table.drop_quick()
181+
super().drop_quick()
182+
165183

166184
class Part(UserTable):
167185
"""

0 commit comments

Comments
 (0)