Skip to content

Commit f588862

Browse files
fix: remove dead _part_integrity attribute, add iteration comment
_part_integrity was set in __init__, copy constructor, and cascade() but never read — part_integrity flows as a function argument to _propagate_restrictions(), not through instance state. Add comment explaining the 50-iteration safety limit in load_all_downstream() (cross-schema FK chains could theoretically cycle, unlike the DAG within a schema). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent aabc88d commit f588862

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/datajoint/dependencies.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,10 @@ def load_all_downstream(self) -> None:
242242
self.load()
243243
return
244244

245-
max_iterations = 50
246-
for _ in range(max_iterations):
245+
# Safety limit: cross-schema FK chains are typically 3-5 deep.
246+
# Unlike the DAG within a schema, cross-schema references could
247+
# theoretically form cycles, so we cap iterations.
248+
for _ in range(50):
247249
schemas_list = ", ".join(adapter.quote_string(s) for s in known_schemas)
248250
result = self._conn.query(adapter.find_downstream_schemas_sql(schemas_list))
249251
new_schemas = {row[0] for row in result} - known_schemas

src/datajoint/diagram.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def __init__(self, source, context=None) -> None:
9999
self._cascade_restrictions = copy_module.deepcopy(source._cascade_restrictions)
100100
self._restrict_conditions = copy_module.deepcopy(source._restrict_conditions)
101101
self._restriction_attrs = copy_module.deepcopy(source._restriction_attrs)
102-
self._part_integrity = source._part_integrity
103102
super().__init__(source)
104103
return
105104

@@ -127,7 +126,6 @@ def __init__(self, source, context=None) -> None:
127126
self._cascade_restrictions = {}
128127
self._restrict_conditions = {}
129128
self._restriction_attrs = {}
130-
self._part_integrity = "enforce"
131129

132130
# Enumerate nodes from all the items in the list
133131
self.nodes_to_show = set()
@@ -357,7 +355,7 @@ def cascade(cls, table_expr, part_integrity="enforce"):
357355
result._cascade_restrictions = {}
358356
result._restrict_conditions = {}
359357
result._restriction_attrs = {}
360-
result._part_integrity = part_integrity
358+
361359
# Include seed + all descendants
362360
descendants = set(nx.descendants(result, node)) | {node}
363361
result.nodes_to_show = descendants

0 commit comments

Comments
 (0)