schema.rebuild_lineage() fails on PostgreSQL, after emptying ~lineage
Los mantenedores suelen responder en 4 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 197
- Forks
- 101
- Merge medio
- 3 d 8 h
- PR fusionados (30 d)
- 28
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de datajoint/datajoint-python
-
len() of an expression with an empty primary key generates invalid SQLPosiblemente ocupada @dimitri-yatsenko la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
datajoint/datajoint-python#1581 ·
Los mantenedores suelen responder en 4 días
-
dj.Diagram theme: make the font configurablePosiblemente ocupada @dimitri-yatsenko la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
datajoint/datajoint-python#1539 · 3 comentarios ·
Los mantenedores suelen responder en 4 días
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
datajoint/datajoint-python#1644 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schemaPosiblemente ocupada @dimitri-yatsenko la tomó hace 5 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 82/100
datajoint/datajoint-python#1640 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
PostgreSQL: renaming an attribute of a dj.U restriction quotes it with backticksPosiblemente ocupada @mayuriphad la tomó hace 5 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
datajoint/datajoint-python#1638 ·
Los mantenedores suelen responder en 4 días
Todos los issues de datajoint/datajoint-python
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
sergey-miryanov/gcmon#230 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Azure-Samples/azure-search-openai-demo#3249 ·
Los mantenedores suelen responder en 1 día
-
[BUG] Failed archive extraction deletes the dataset cachePosiblemente ocupada @dajiaohuang la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
alibaba/GraphScope#4674 ·