Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
af17b58
docs: Add singleton tables documentation
dimitri-yatsenko Jan 22, 2026
f832270
docs: Mark singleton tables as New in v2.1
dimitri-yatsenko Jan 22, 2026
6e5f8a6
fix: Make notebooks backend-agnostic (MySQL/PostgreSQL compatible)
dimitri-yatsenko Jan 22, 2026
6abdc0c
docs: Add environment variable configuration to all notebooks
dimitri-yatsenko Jan 23, 2026
742a7a2
docs: Separate config from notebooks, add PostgreSQL compatibility
dimitri-yatsenko Jan 23, 2026
784df1f
docs: Simplify JSON tutorial, add test outputs
dimitri-yatsenko Jan 23, 2026
074281a
docs: Update PostgreSQL test output (21/21 passed)
dimitri-yatsenko Jan 23, 2026
4c01f17
docs: Re-execute notebooks with TLS disabled, add execution script
dimitri-yatsenko Jan 23, 2026
0a58d44
fix: PostgreSQL boolean aggregation in queries tutorial
dimitri-yatsenko Jan 23, 2026
7bce685
fix: PostgreSQL string quoting in sql-comparison tutorial
dimitri-yatsenko Jan 23, 2026
1a0174b
docs: Use decimal type for human-entered numeric fields
dimitri-yatsenko Jan 23, 2026
e3376bd
docs: Use decimal for reaction_time, fix decimal-to-float conversions
dimitri-yatsenko Jan 23, 2026
e166326
Merge pre/v2.1 into docs/singleton-tables
dimitri-yatsenko Jan 23, 2026
0934958
docs: Re-execute all notebooks after merge
dimitri-yatsenko Jan 23, 2026
a9dc9d0
docs: add testing guide and replace Russian with Ukrainian
dimitri-yatsenko Jan 23, 2026
3119156
docs: add testing guide to how-to index
dimitri-yatsenko Jan 23, 2026
c427c8e
docs: use single quotes for strings in SQL restrictions
dimitri-yatsenko Jan 23, 2026
217cae5
Merge branch 'main' into docs/singleton-tables
MilagrosMarin Jan 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Pytest configuration for notebook tests.

Configures DataJoint from environment variables before any tests run.
This separates configuration from workflow execution.

Usage:
# MySQL (default)
DJ_HOST=localhost DJ_USER=root DJ_PASS=tutorial pytest --nbmake ...

# PostgreSQL
DJ_HOST=localhost DJ_PORT=5432 DJ_USER=datajoint DJ_PASS=tutorial DJ_BACKEND=postgresql pytest --nbmake ...
"""

import os


def pytest_configure(config):
"""Configure DataJoint from environment variables before tests run."""
import datajoint as dj

# Database connection settings
if os.getenv('DJ_HOST'):
dj.config['database.host'] = os.getenv('DJ_HOST')
if os.getenv('DJ_PORT'):
dj.config['database.port'] = int(os.getenv('DJ_PORT'))
if os.getenv('DJ_USER'):
dj.config['database.user'] = os.getenv('DJ_USER')
if os.getenv('DJ_PASS'):
dj.config['database.password'] = os.getenv('DJ_PASS')
if os.getenv('DJ_BACKEND'):
dj.config['database.backend'] = os.getenv('DJ_BACKEND')

# Display settings for notebooks
dj.config['display.limit'] = 8
2 changes: 2 additions & 0 deletions mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ nav:
- Migrate to 2.0: how-to/migrate-to-v20.md
- Alter Tables: how-to/alter-tables.md
- Backup and Restore: how-to/backup-restore.md
- Testing:
- Testing Best Practices: how-to/testing.md
- Reference:
- reference/index.md
- Specifications:
Expand Down
8 changes: 4 additions & 4 deletions src/explanation/computation-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ Each auto-populated table has an associated jobs table:
Segmentation.jobs()

# View errors
Segmentation.jobs & 'status = "error"'
Segmentation.jobs & "status = 'error'"

# Clear errors to retry
(Segmentation.jobs & 'status = "error"').delete()
(Segmentation.jobs & "status = 'error'").delete()
```

### Parallel Execution
Expand All @@ -134,13 +134,13 @@ Jobs are reserved atomically—no two workers process the same key.
Segmentation.populate(suppress_errors=True)

# Check what failed
errors = (Segmentation.jobs & 'status = "error"').to_dicts()
errors = (Segmentation.jobs & "status = 'error'").to_dicts()

# Clear specific error to retry
(Segmentation.jobs & error_key).delete()

# Clear all errors
(Segmentation.jobs & 'status = "error"').delete()
(Segmentation.jobs & "status = 'error'").delete()
```

## Imported vs. Computed
Expand Down
6 changes: 3 additions & 3 deletions src/explanation/query-algebra.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ Filter entities based on conditions.

```python
# Mice born after 2024
Mouse & 'date_of_birth > "2024-01-01"'
Mouse & "date_of_birth > '2024-01-01'"

# Sessions for a specific mouse
Session & {'mouse_id': 42}

# Sessions matching a query
Session & (Mouse & 'strain = "C57BL/6"')
Session & (Mouse & "strain = 'C57BL/6'")
```

### Exclude (`-`)
Expand Down Expand Up @@ -221,7 +221,7 @@ Operators compose freely:
```python
# Complex query
result = (
(Mouse & 'strain = "C57BL/6"') # Filter mice
(Mouse & "strain = 'C57BL/6'") # Filter mice
* Session # Join sessions
* Scan # Join scans
.proj('scan_date', 'depth') # Select attributes
Expand Down
6 changes: 3 additions & 3 deletions src/how-to/delete-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Delete rows matching a restriction:
(Subject & {'subject_id': 'M001'}).delete()

# Delete with condition
(Session & 'session_date < "2024-01-01"').delete()
(Session & "session_date < '2024-01-01'").delete()
```

## Cascade Behavior
Expand Down Expand Up @@ -141,14 +141,14 @@ Delete without cascade (fails if dependent rows exist):
### By Condition

```python
(Trial & 'outcome = "miss"').delete()
(Trial & "outcome = 'miss'").delete()
```

### By Join

```python
# Delete trials from sessions before 2024
old_sessions = Session & 'session_date < "2024-01-01"'
old_sessions = Session & "session_date < '2024-01-01'"
(Trial & old_sessions).delete()
```

Expand Down
2 changes: 1 addition & 1 deletion src/how-to/handle-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Target specific failed jobs:

```python
# Clear one error
(ProcessedData.jobs & key & 'status="error"').delete()
(ProcessedData.jobs & key & "status='error'").delete()

# Retry just that key
ProcessedData.populate(key, reserve_jobs=True)
Expand Down
4 changes: 4 additions & 0 deletions src/how-to/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ they assume you understand the basics and focus on getting things done.
- [Migrate to v2.0](migrate-to-v20.md) — Upgrading existing pipelines
- [Alter Tables](alter-tables.md) — Schema evolution
- [Backup and Restore](backup-restore.md) — Data protection

## Testing

- [Testing Best Practices](testing.md) — Integration testing with pytest
4 changes: 2 additions & 2 deletions src/how-to/migrate-to-v20.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def test_query_patterns(test_schema):
assert len(mice) == 1

# Test restriction
male_mice = Mouse & 'sex="M"'
male_mice = Mouse & "sex='M'"
assert len(male_mice) == 1
```

Expand Down Expand Up @@ -417,7 +417,7 @@ def test_full_pipeline(test_schema):
assert len(Analysis()) > 0

# 4. Test queries work
alice_sessions = Session & 'experimenter="Alice"'
alice_sessions = Session & "experimenter='Alice'"
assert len(alice_sessions) == 1
```

Expand Down
Loading