schema.rebuild_lineage() fails on PostgreSQL, after emptying ~lineage
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 197
- フォーク
- 101
- 平均マージ
- 3日 8時間
- マージ済み PR(30日)
- 28
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
datajoint/datajoint-python のほかの issue
-
len() of an expression with an empty primary key generates invalid SQL対応中かも @dimitri-yatsenko が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
datajoint/datajoint-python#1581 ·
メンテナーはふだん 4 日以内に返信
-
dj.Diagram theme: make the font configurable対応中かも @dimitri-yatsenko が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
datajoint/datajoint-python#1539 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
datajoint/datajoint-python#1644 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schema対応中かも @dimitri-yatsenko が 4 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 82/100
datajoint/datajoint-python#1640 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
PostgreSQL: renaming an attribute of a dj.U restriction quotes it with backticks対応中かも @mayuriphad が 4 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
datajoint/datajoint-python#1638 ·
メンテナーはふだん 4 日以内に返信
datajoint/datajoint-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
CLIMADA-project/climada_python#1337 ·
メンテナーはふだん 3 日以内に返信
-
tail without reverseオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
8go/matrix-commander#233 ·
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
documentation enhancement priority:high size:M
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Validate non-divisible effective batch sizes in the Unsloth LoRA backend対応中かも @debesh-biswas が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100