Skip to content

Commit 902c925

Browse files
docs: move What's New pages to About, add 2.1, complete 2.2
- Move What's New 2.0 and 2.2 from Concepts > Overview to About section - Create What's New in 2.1: PostgreSQL backend, diagram enhancements (layout direction, Mermaid, schema grouping, collapse), singleton tables - Complete What's New in 2.2 Diagram coverage: restriction propagation rules, dry_run parameter, multiple FK convergence, unloaded schema detection - Fix all broken links from the file move (8 files updated) - Add release notes links to all three What's New pages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 32c4a40 commit 902c925

12 files changed

Lines changed: 180 additions & 28 deletions

File tree

mkdocs.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ nav:
1010
- explanation/index.md
1111
- Overview:
1212
- Data Pipelines: explanation/data-pipelines.md
13-
- What's New in 2.0: explanation/whats-new-2.md
14-
- What's New in 2.2: explanation/whats-new-22.md
1513
- FAQ: explanation/faq.md
1614
- Data Model:
1715
- Relational Workflow Model: explanation/relational-workflow-model.md
@@ -127,6 +125,9 @@ nav:
127125
- API: api/ # Auto-generated via gen-files + literate-nav
128126
- About:
129127
- about/index.md
128+
- What's New in 2.2: about/whats-new-22.md
129+
- What's New in 2.1: about/whats-new-21.md
130+
- What's New in 2.0: about/whats-new-2.md
130131
- History: about/history.md
131132
- Documentation Versioning: about/versioning.md
132133
- Platform: https://www.datajoint.com/sign-up
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% if config.extra.datajoint_version %}
2-
<a href="{{ 'explanation/whats-new-2/' | url }}">
2+
<a href="{{ 'about/whats-new-2/' | url }}">
33
Documentation for DataJoint {{ config.extra.datajoint_version }}
44
</a>
55
{% endif %}

src/about/versioning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ print(dj.__version__)
8787

8888
If you're upgrading from legacy DataJoint (pre-2.0):
8989

90-
1. **Review** the [What's New in 2.0](../explanation/whats-new-2.md) page to understand major changes
90+
1. **Review** the [What's New in 2.0](whats-new-2.md) page to understand major changes
9191
2. **Follow** the [Migration Guide](../how-to/migrate-to-v20.md) for step-by-step upgrade instructions
9292
3. **Reference** this documentation for updated syntax and APIs
9393

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -274,20 +274,12 @@ Most users complete Phases 1-2 in a single session. Phases 3-4 only apply if you
274274

275275
## See Also
276276

277-
### Migration
278-
- **[Migration Guide](../how-to/migrate-to-v20.md/)** — Complete upgrade instructions
279-
- [Configuration](../how-to/configure-database.md/) — Setup new configuration system
280-
281-
### Core Concepts
282-
- [Type System](type-system.md) — Understand the three-tier type architecture
283-
- [Computation Model](computation-model.md) — Jobs 2.0 and AutoPopulate
284-
- [Query Algebra](query-algebra.md) — Semantic matching and operators
285-
286-
### Getting Started
287-
- [Installation](../how-to/installation.md/) — Install DataJoint 2.0
288-
- [Tutorials](../tutorials/index.md/) — Learn by example
289-
290-
### Reference
291-
- [Type System Specification](../reference/specs/type-system.md/) — Complete type system details
292-
- [Codec API](../reference/specs/codec-api.md/) — Build custom codecs
293-
- [AutoPopulate Specification](../reference/specs/autopopulate.md/) — Jobs 2.0 reference
277+
- [What's New in 2.1](whats-new-21.md) — Next release
278+
- [Release Notes (v2.0.0)](https://github.com/datajoint/datajoint-python/releases/tag/v2.0.0) — GitHub changelog
279+
- **[Migration Guide](../how-to/migrate-to-v20.md)** — Complete upgrade instructions
280+
- [Configuration](../how-to/configure-database.md) — Setup new configuration system
281+
- [Type System](../explanation/type-system.md) — Understand the three-tier type architecture
282+
- [Computation Model](../explanation/computation-model.md) — Jobs 2.0 and AutoPopulate
283+
- [Query Algebra](../explanation/query-algebra.md) — Semantic matching and operators
284+
- [Installation](../how-to/installation.md) — Install DataJoint 2.0
285+
- [Tutorials](../tutorials/index.md) — Learn by example

src/about/whats-new-21.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# What's New in DataJoint 2.1
2+
3+
DataJoint 2.1 adds **PostgreSQL as a production backend**, **enhanced diagram visualization**, and **singleton tables**.
4+
5+
> **Upgrading from 2.0?** No breaking changes. All existing code continues to work. New features are purely additive.
6+
7+
> **Citation:** Yatsenko D, Nguyen TT. *DataJoint 2.0: A Computational Substrate for Agentic Scientific Workflows.* arXiv:2602.16585. 2026. [doi:10.48550/arXiv.2602.16585](https://doi.org/10.48550/arXiv.2602.16585)
8+
9+
## PostgreSQL Backend
10+
11+
DataJoint now supports PostgreSQL 15+ as a production database backend alongside MySQL 8+. The adapter architecture generates backend-specific SQL while maintaining a consistent API — the same table definitions, queries, and pipeline logic work on both backends.
12+
13+
```bash
14+
export DJ_BACKEND=postgresql
15+
export DJ_HOST=localhost
16+
export DJ_PORT=5432
17+
```
18+
19+
Or configure programmatically:
20+
21+
```python
22+
dj.config['database.backend'] = 'postgresql'
23+
```
24+
25+
All core types (`int32`, `float64`, `varchar`, `uuid`, `json`), codec types (`<blob>`, `<attach>`, `<object@>`), query operations, foreign keys, indexes, and auto-populate work identically across backends. Backend-specific differences are handled internally by the adapter layer.
26+
27+
See [Database Backends](../reference/specs/database-backends.md) for the full specification.
28+
29+
## Diagram Enhancements
30+
31+
`dj.Diagram` gains several visualization features for working with complex, multi-schema pipelines.
32+
33+
### Layout Direction
34+
35+
Control the flow direction of diagrams:
36+
37+
```python
38+
# Horizontal layout
39+
dj.config.display.diagram_direction = "LR"
40+
41+
# Or temporarily
42+
with dj.config.override(display__diagram_direction="LR"):
43+
dj.Diagram(schema).draw()
44+
```
45+
46+
| Value | Description |
47+
|-------|-------------|
48+
| `"TB"` | Top to bottom (default) |
49+
| `"LR"` | Left to right |
50+
51+
### Mermaid Output
52+
53+
Generate [Mermaid](https://mermaid.js.org/) syntax for embedding diagrams in Markdown, GitHub, or web documentation:
54+
55+
```python
56+
print(dj.Diagram(schema).make_mermaid())
57+
```
58+
59+
Save directly to `.mmd` or `.mermaid` files:
60+
61+
```python
62+
dj.Diagram(schema).save("pipeline.mmd")
63+
```
64+
65+
### Schema Grouping
66+
67+
Multi-schema diagrams automatically group tables into visual clusters by database schema. The cluster label shows the Python module name when available, following the DataJoint convention of one module per schema.
68+
69+
```python
70+
combined = dj.Diagram(schema1) + dj.Diagram(schema2)
71+
combined.draw() # tables grouped by schema
72+
```
73+
74+
### Collapsing Schemas
75+
76+
For high-level pipeline views, collapse entire schemas into single nodes:
77+
78+
```python
79+
# Show schema1 expanded, schema2 as a single node with table count
80+
dj.Diagram(schema1) + dj.Diagram(schema2).collapse()
81+
```
82+
83+
The **"expanded wins" rule** applies: if a table appears in both a collapsed and non-collapsed diagram, it stays expanded. This allows showing specific tables while collapsing the rest:
84+
85+
```python
86+
# Subject is expanded, rest of analysis schema is collapsed
87+
dj.Diagram(Subject) + dj.Diagram(analysis).collapse()
88+
```
89+
90+
See [Diagram Specification](../reference/specs/diagram.md) for the full reference.
91+
92+
## Singleton Tables
93+
94+
A **singleton table** holds at most one row. Declare it with no attributes in the primary key section:
95+
96+
```python
97+
@schema
98+
class Config(dj.Lookup):
99+
definition = """
100+
# Global configuration
101+
---
102+
setting1 : varchar(100)
103+
setting2 : int32
104+
"""
105+
```
106+
107+
| Operation | Result |
108+
|-----------|--------|
109+
| Insert | Works without specifying a key |
110+
| Second insert | Raises `DuplicateError` |
111+
| `fetch1()` | Returns the single row |
112+
113+
Useful for global configuration, pipeline parameters, and summary statistics.
114+
115+
See [Table Declaration](../reference/specs/table-declaration.md#25-singleton-tables-empty-primary-keys) for details.
116+
117+
## See Also
118+
119+
- [Database Backends](../reference/specs/database-backends.md) — Full backend specification
120+
- [Diagram Specification](../reference/specs/diagram.md) — Diagram reference
121+
- [Table Declaration](../reference/specs/table-declaration.md) — Singleton tables
122+
- [Configure Database](../how-to/configure-database.md) — Connection setup for both backends
123+
- [What's New in 2.0](whats-new-2.md) — Previous release
124+
- [What's New in 2.2](whats-new-22.md) — Next release
125+
- [Release Notes (v2.1.0)](https://github.com/datajoint/datajoint-python/releases/tag/v2.1.0) — GitHub changelog
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,38 @@ export # visualize the export subgraph
262262

263263
Without prior restrictions, `prune()` removes physically empty tables. This is useful for understanding which parts of a pipeline are populated.
264264

265+
### Restriction Propagation Rules
266+
267+
When `cascade()` or `restrict()` propagates a restriction from a parent to a child, one of three rules applies depending on the foreign key relationship:
268+
269+
| Rule | Condition | Child restriction |
270+
|------|-----------|-------------------|
271+
| **Direct copy** | Non-aliased FK, restriction attributes are a subset of child's primary key | Restriction copied directly |
272+
| **Aliased projection** | FK uses attribute renaming (e.g., `subject_id``animal_id`) | Parent projected with attribute mapping |
273+
| **Full projection** | Non-aliased FK, restriction uses attributes not in child's primary key | Parent projected (all attributes) as restriction |
274+
275+
When a child has multiple restricted ancestors, convergence depends on the mode: `cascade()` uses OR (any path marks a row for deletion), `restrict()` uses AND (all conditions must match).
276+
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+
279+
### Dry Run
280+
281+
`Table.delete()` and `Table.drop()` accept a `dry_run` parameter that returns affected row counts without modifying data:
282+
283+
```python
284+
# Preview what would be deleted
285+
(Session & {'subject_id': 'M001'}).delete(dry_run=True)
286+
# {'`lab`.`session`': 3, '`lab`.`trial`': 45, '`lab`.`processed_data`': 45}
287+
288+
# Preview what would be dropped
289+
Session.drop(dry_run=True)
290+
# {'`lab`.`session`': 100, '`lab`.`trial`': 5000}
291+
```
292+
293+
### Unloaded Schema Detection
294+
295+
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.
296+
265297
### Architecture
266298

267299
`Table.delete()` constructs a `Diagram` internally, calls `cascade()` to compute the affected subgraph, then executes the delete itself in reverse topological order. The Diagram is purely a graph computation and inspection tool — it computes the cascade and provides `preview()`, but all mutation logic (transactions, SQL execution, prompts) lives in `Table.delete()` and `Table.drop()`.
@@ -282,6 +314,8 @@ The graph-driven approach resolves every known limitation of the prior error-dri
282314

283315
## See Also
284316

317+
- [What's New in 2.1](whats-new-21.md) — Previous release
318+
- [Release Notes (v2.2.0)](https://github.com/datajoint/datajoint-python/releases) — GitHub changelog
285319
- [Use Isolated Instances](../how-to/use-instances.md) — Task-oriented guide
286320
- [Working with Instances](../tutorials/advanced/instances.ipynb) — Step-by-step tutorial
287321
- [Configuration Reference](../reference/configuration.md) — Thread-safe mode settings

src/explanation/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ and scalable.
5353

5454
How DataJoint ensures safe joins through attribute lineage tracking.
5555

56-
- :material-new-box: **[What's New in 2.0](whats-new-2.md)**
56+
- :material-new-box: **[What's New in 2.0](../about/whats-new-2.md)**
5757

5858
Major changes, new features, and migration guidance for DataJoint 2.0.
5959

src/how-to/use-instances.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,6 @@ def test_insert(test_instance):
139139

140140
## See Also
141141

142-
- [What's New in 2.2](../explanation/whats-new-22.md/) — Feature overview and rationale
142+
- [What's New in 2.2](../about/whats-new-22.md) — Feature overview and rationale
143143
- [Working with Instances](../tutorials/advanced/instances.ipynb/) — Step-by-step tutorial
144144
- [Configuration Reference](../reference/configuration.md/) — Thread-safe mode settings

src/llms.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Concepts
88

9-
- [What's New in 2.0](/explanation/whats-new-2.md): Major changes and new features in DataJoint 2.0
9+
- [What's New in 2.0](/about/whats-new-2.md): Major changes and new features in DataJoint 2.0
1010
- [Relational Workflow Model](/explanation/relational-workflow-model.md): Core data model concepts
1111
- [Entity Integrity](/explanation/entity-integrity.md): How DataJoint ensures data consistency
1212
- [Normalization](/explanation/normalization.md): Database normalization principles

src/reference/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ schema = inst.Schema("my_schema")
318318
| `inst.Schema(name)` | Create a Schema bound to this Instance |
319319
| `inst.FreeTable(full_name)` | Create a FreeTable bound to this Instance |
320320

321-
See [What's New in 2.2](../explanation/whats-new-22.md/) for usage examples and rationale.
321+
See [What's New in 2.2](../about/whats-new-22.md) for usage examples and rationale.
322322

323323
## Thread-Safe Mode
324324

0 commit comments

Comments
 (0)