PostgreSQL becomes the default backend

Offen
#1,627 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 6 Tagen

@dimitri-yatsenko arbeitet bereits daran.

Seit 17.10.2026.

  • #1629 von @dimitri-yatsenko — offen

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
docker-compose, mysql, postgresql, python

Rechercherichtung

Start with the database backend configuration and connection setup, then inspect the settings docstring, CLI help, docker-compose.yaml, and CONTRIBUTING.md; the issue does not name source files. Update PostgreSQL defaults and backend-aware port selection, while ensuring MySQL fixtures and users select MySQL explicitly. Run the relevant test suite and verify dj.config.save_template(), connection error behavior, and documentation examples.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement

Motivation

DataJoint supports PostgreSQL and MySQL as production backends, with the same features on both. Today database.backend defaults to "mysql", so a new user who installs DataJoint and connects without configuring a backend gets MySQL.

PostgreSQL becomes the default backend. A new install should work against PostgreSQL with no backend setting, and the documentation, examples, and test runs should lead with it. MySQL stays a fully supported backend; selecting it takes one setting.

The change

  • database.backend defaults to "postgresql", and the default port is 5432.

  • The port follows the backend unless it is set. Today the port is derived only when the settings are first built, so database.backend set in datajoint.json or assigned at run time leaves the other backend's port in place. After this change, backend: "mysql" with no port connects on 3306.

  • If a connection fails while the backend is still the default, so that neither the configuration nor the code chose one, the error adds:

    The default backend is postgresql since DataJoint 2.4; set database.backend='mysql' (DJ_BACKEND=mysql) for a MySQL server.
    

    A backend set by DJ_BACKEND, datajoint.json, dj.config, or the backend argument of dj.Connection / dj.Instance counts as chosen, and its connection errors are raised unchanged.

  • dj.config.save_template() writes "backend": "postgresql" and port 5432.

  • The settings docstring, CLI help, docker-compose.yaml, and CONTRIBUTING.md list PostgreSQL first.

  • The test fixtures that connect to the MySQL test server select MySQL explicitly instead of relying on the default.

Migration for MySQL users

Select the MySQL backend in any one of these ways:

  • Environment: export DJ_BACKEND=mysql

  • datajoint.json:

    {
      "database": {
        "backend": "mysql",
        "host": "db.example.org"
      }
    }
    
  • In code, before connecting: dj.config["database.backend"] = "mysql"

  • For an isolated instance: dj.Instance(host=..., user=..., password=..., backend="mysql")

With the backend set, the port defaults to 3306. A port set explicitly (DJ_PORT, database.port, or host:port) is kept as is. A MySQL setup that sets no backend fails to connect with the message above.

Vorherrschende Sprache
Python
Sterne
198
Forks
103
Ø Merge
6 T. 1 Std.
Gemergte PRs (30 T.)
10

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus datajoint/datajoint-python

Alle Issues in datajoint/datajoint-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.