Skip to content

Commit 1e957ef

Browse files
docs: add PostgreSQL configuration to CONTRIBUTING.md
- Document PostgreSQL 15+ as supported backend alongside MySQL 8+ - Add PostgreSQL environment variables (DJ_PG_HOST, DJ_PG_PORT, etc.) - Document backend-parameterized tests and how to run per-backend - Show pip install with [postgres] extra for psycopg2-binary - Add PostgreSQL to external containers instructions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 629c3c7 commit 1e957ef

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

CONTRIBUTING.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,46 @@ pytest tests/
3636

3737
## Running Tests
3838

39-
Tests use [testcontainers](https://testcontainers.com/) to automatically manage MySQL and MinIO containers. No manual `docker-compose up` required.
39+
Tests use [testcontainers](https://testcontainers.com/) to automatically manage MySQL, PostgreSQL, and MinIO containers. No manual `docker-compose up` required.
40+
41+
Integration tests are **backend-parameterized** — tests using the `backend` fixture run automatically against both MySQL and PostgreSQL.
4042

4143
```bash
42-
pixi run test # All tests
44+
pixi run test # All tests (both backends)
4345
pixi run test-cov # With coverage
4446
pixi run -e test pytest tests/unit/ # Unit tests only
4547
pixi run -e test pytest tests/integration/test_blob.py -v # Specific file
48+
pixi run -e test pytest -m mysql # MySQL tests only
49+
pixi run -e test pytest -m postgresql # PostgreSQL tests only
4650
```
4751

4852
**macOS Docker Desktop users:** If tests fail to connect:
4953
```bash
5054
export DOCKER_HOST=unix://$HOME/.docker/run/docker.sock
5155
```
5256

57+
### PostgreSQL Backend
58+
59+
DataJoint supports PostgreSQL 15+ as an alternative to MySQL 8+. To install the PostgreSQL driver:
60+
61+
```bash
62+
pip install -e ".[postgres]" # Installs psycopg2-binary
63+
```
64+
65+
Tests automatically spin up both MySQL and PostgreSQL containers via testcontainers. Backend-parameterized tests (those using the `backend` fixture in `tests/conftest.py`) run against both backends to ensure feature parity.
66+
5367
### External Containers (for debugging)
5468

5569
```bash
70+
# MySQL + MinIO
5671
docker compose up -d db minio
5772
DJ_USE_EXTERNAL_CONTAINERS=1 pixi run test
5873
docker compose down
74+
75+
# MySQL + PostgreSQL + MinIO
76+
docker compose up -d db postgres minio
77+
DJ_USE_EXTERNAL_CONTAINERS=1 pixi run test
78+
docker compose down
5979
```
6080

6181
### Full Docker
@@ -91,12 +111,28 @@ Hooks include: **ruff** (lint/format), **codespell**, YAML/JSON/TOML validation.
91111

92112
For `DJ_USE_EXTERNAL_CONTAINERS=1`:
93113

114+
### MySQL
115+
94116
| Variable | Default | Description |
95117
|----------|---------|-------------|
96118
| `DJ_HOST` | `localhost` | MySQL hostname |
97119
| `DJ_PORT` | `3306` | MySQL port |
98120
| `DJ_USER` | `root` | MySQL username |
99121
| `DJ_PASS` | `password` | MySQL password |
122+
123+
### PostgreSQL
124+
125+
| Variable | Default | Description |
126+
|----------|---------|-------------|
127+
| `DJ_PG_HOST` | `localhost` | PostgreSQL hostname |
128+
| `DJ_PG_PORT` | `5432` | PostgreSQL port |
129+
| `DJ_PG_USER` | `postgres` | PostgreSQL username |
130+
| `DJ_PG_PASS` | `password` | PostgreSQL password |
131+
132+
### Object Storage
133+
134+
| Variable | Default | Description |
135+
|----------|---------|-------------|
100136
| `S3_ENDPOINT` | `localhost:9000` | MinIO endpoint |
101137

102138
---

0 commit comments

Comments
 (0)