Skip to content

Commit f77b21a

Browse files
docs: document load_all_downstream() for cross-schema diagrams
Add usage examples to Diagram class docstring and Dependencies.load_all_downstream() showing how to include tables from unactivated downstream schemas in visualization. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f0ac258 commit f77b21a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/datajoint/dependencies.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,13 @@ def load_all_downstream(self) -> None:
235235
found. This ensures that cascade delete and drop reach all
236236
dependent tables, even those in schemas that haven't been
237237
explicitly activated.
238+
239+
Called automatically by ``Diagram.cascade()`` and ``Table.drop()``.
240+
Call manually before constructing a ``Diagram`` to include
241+
cross-schema dependencies in visualization::
242+
243+
conn.dependencies.load_all_downstream()
244+
dj.Diagram(schema) # now includes all downstream schemas
238245
"""
239246
adapter = self._conn.adapter
240247
known_schemas = set(self._conn.schemas)

src/datajoint/diagram.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,14 @@ class Diagram(nx.DiGraph): # noqa: C901
8080
Notes
8181
-----
8282
``diagram + 1 - 1`` may differ from ``diagram - 1 + 1``.
83-
Only tables loaded in the connection are displayed.
83+
Only tables in activated schemas are displayed. To include tables in
84+
downstream schemas that depend on the current schema but haven't been
85+
explicitly activated::
86+
87+
conn.dependencies.load_all_downstream()
88+
dj.Diagram(schema) # now includes all downstream schemas
89+
90+
``Diagram.cascade()`` calls ``load_all_downstream()`` automatically.
8491
8592
Layout direction is controlled via ``dj.config.display.diagram_direction``
8693
(default ``"TB"``). Use ``dj.config.override()`` to change temporarily::

0 commit comments

Comments
 (0)