drop() leaves the jobs table behind, and a table re-declared under the same name inherits it
Les mainteneurs répondent en général sous 6 jours
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 25/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- mysql, python
- Domaine
- backend-api-design, databases
Piste de recherche
Start with table.py:1224 (drop_quick) and the lazy jobs-table creation in autopopulate.py:182-188. Trace how AutoPopulate.jobs validates and uses the jobs table, then update the drop behavior and add the primary-key compatibility check. The issue is done when dropping a table also removes its jobs table and an existing mismatched jobs table raises an error.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
drop() removes an auto-populated table but not its jobs table, ~~<table_name>. drop_quick() (table.py:1224) drops only full_table_name. The jobs table is created lazily by AutoPopulate.jobs (autopopulate.py:182-188), and nothing else removes it, so it stays, with its records and its primary key.
When a table is later declared under the same name, its jobs property picks up the old jobs table. If the new table's primary key differs, populate(reserve_jobs=True) computes nothing and raises no error. refresh() adds key_source - target - jobs, and the old records, keyed on part of the new primary key, cover every new key.
Reproduction
DataJoint 2.3.5.dev8 (master, a00b89f5), MySQL 8.0.46, Python 3.11:
import datajoint as dj
schema = dj.Schema("scratch_drop_jobs")
@schema
class Item(dj.Manual):
definition = """
item : int32
"""
@schema
class Param(dj.Lookup):
definition = """
param : int32
"""
contents = [(1,), (2,)]
@schema
class Result(dj.Computed):
definition = """
-> Item
---
value : int32
"""
def make(self, key):
raise RuntimeError("not ready")
Item.insert({"item": i} for i in range(3))
Result.populate(reserve_jobs=True, suppress_errors=True)
Result.drop(prompt=False)
print("tables after drop:", [r[0] for r in schema.connection.query("SHOW TABLES FROM `scratch_drop_jobs`")])
@schema
class Result(dj.Computed): # same name, primary key now includes Param
definition = """
-> Item
-> Param
---
value : int32
"""
def make(self, key):
self.insert1(dict(key, value=1))
print("jobs primary key:", Result.jobs.heading.primary_key, "records:", [j["status"] for j in Result.jobs.to_dicts()])
Result.populate(reserve_jobs=True)
print("rows after populate(reserve_jobs=True):", len(Result()), "of", len(Result.key_source))
Output:
tables after drop: ['#param', 'item', '~lineage', '~~result']
jobs primary key: ['item'] records: ['error', 'error', 'error']
rows after populate(reserve_jobs=True): 0 of 6
Expected behavior
drop()drops each table's jobs table along with the table, as it already removes the table's~lineageentries.AutoPopulate.jobschecks that an existing jobs table's primary key matches the table's, and raises if it does not. That also catches jobs tables left behind by earlier releases.
- Langage dominant
- Python
- Étoiles
- 198
- Forks
- 103
- Merge moyen
- 6 j 1 h
- PR mergées (30 j)
- 10
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
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
datajoint/datajoint-python#1703 ·
Les mainteneurs répondent en général sous 6 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
datajoint/datajoint-python#1702 ·
Les mainteneurs répondent en général sous 6 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
datajoint/datajoint-python#1701 ·
Les mainteneurs répondent en général sous 6 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
datajoint/datajoint-python#1691 ·
Les mainteneurs répondent en général sous 6 jours
-
dependencies needs-discussion
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
datajoint/datajoint-python#1687 ·
Les mainteneurs répondent en général sous 6 jours
Toutes les issues de datajoint/datajoint-python
Issues similaires
-
needs-triage
Difficulté 1/5 1-3 heures Accessibilité débutants 85/100
gke-labs/kube-agents#6620 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
open-webui/open-webui#34719 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
cognition
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
One non-object JSON record makes the session catalog exitPeut-être pris @he-yufeng l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
[Suggestion]: Geonode MCP ServerOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
collabnix/awesome-mcp-lists#433 ·
Les mainteneurs répondent en général sous 4 jours