schema.rebuild_lineage() fails on PostgreSQL, after emptying ~lineage
Les mainteneurs répondent en général sous 4 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 68/100
Piste de recherche
Start in lineage.py at rebuild_schema_lineage and compare its information_schema queries with the adapters’ load_primary_keys_sql and load_foreign_keys_sql used by Dependencies.load. Reproduce on PostgreSQL 15 with the supplied schema and check how the function handles ~lineage when rebuilding fails. Done means lineage rebuilding works on PostgreSQL and MySQL, and a failure does not leave ~lineage empty.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
schema.rebuild_lineage() fails on PostgreSQL. rebuild_schema_lineage (lineage.py) reads keys from information_schema with MySQL-only names:
- foreign keys from
KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,REFERENCED_TABLE_NAMEandREFERENCED_COLUMN_NAME, columns PostgreSQL does not have; - primary keys by
CONSTRAINT_NAME = 'PRIMARY', while PostgreSQL names a primary-key constraint<table>_pkey.
The foreign-key query raises, so the rebuild stops before writing anything. It has already run DELETE FROM ~lineage by then, so the call leaves the schema with an empty ~lineage table: every join on the schema's tables is then refused, until each table is decorated again and its rows are refilled.
The docs and several messages recommend schema.rebuild_lineage() as the repair for lineage problems, and dj.migrate.rebuild_lineage calls the same function.
Reproduction
DataJoint master, PostgreSQL 15:
import datajoint as dj
schema = dj.Schema("scratch_rebuild_lineage")
@schema
class Image(dj.Manual):
definition = """
image_id : int32
"""
schema.rebuild_lineage()
# UnknownAttributeError: column "referenced_table_schema" does not exist
# ~lineage held 1 row before the call and 0 after it
Expected behavior
rebuild_lineage() works on both backends. It could read primary and foreign keys through the adapters' existing load_primary_keys_sql and load_foreign_keys_sql, as Dependencies.load does, and leave ~lineage unchanged if it fails.
- Langage dominant
- Python
- Étoiles
- 197
- Forks
- 101
- Merge moyen
- 3 j 8 h
- PR mergées (30 j)
- 28
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de datajoint/datajoint-python
-
len() of an expression with an empty primary key generates invalid SQLPeut-être pris @dimitri-yatsenko l’a pris il y a 4 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
datajoint/datajoint-python#1581 ·
Les mainteneurs répondent en général sous 4 jours
-
dj.Diagram theme: make the font configurablePeut-être pris @dimitri-yatsenko l’a pris il y a 4 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
datajoint/datajoint-python#1539 · 3 commentaires ·
Les mainteneurs répondent en général sous 4 jours
-
enhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
datajoint/datajoint-python#1644 · 1 commentaire ·
Les mainteneurs répondent en général sous 4 jours
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schemaPeut-être pris @dimitri-yatsenko l’a pris il y a 4 jours. Ouvertebug
Difficulté 3/5 1-2 jours Accessibilité débutants 82/100
datajoint/datajoint-python#1640 · 1 commentaire ·
Les mainteneurs répondent en général sous 4 jours
-
PostgreSQL: renaming an attribute of a dj.U restriction quotes it with backticksPeut-être pris @mayuriphad l’a pris il y a 4 jours. Ouvertebug
Difficulté 3/5 1-2 jours Accessibilité débutants 75/100
datajoint/datajoint-python#1638 ·
Les mainteneurs répondent en général sous 4 jours
Toutes les issues de datajoint/datajoint-python
Issues similaires
-
[Bug]: IndexHandler.post crashes with HTTP 500 on malformed payloads, missing credentials, or when login is disabledPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 6 jours
-
Bump zizmor to 1.31.1+Ouvertegithub_actions
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
collective/icalendar#2003 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
openzim/python-scraperlib#360 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
volcengine/OpenViking#6445 ·
Les mainteneurs répondent en général sous 1 jour