schema.rebuild_lineage() fails on PostgreSQL, after emptying ~lineage
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 197
- Fork
- 101
- Merge trung bình
- 3 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 28
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của datajoint/datajoint-python
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
datajoint/datajoint-python#1646 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
len() of an expression with an empty primary key generates invalid SQLCó thể đã có người làm @dimitri-yatsenko đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
datajoint/datajoint-python#1581 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
dj.Diagram theme: make the font configurableCó thể đã có người làm @dimitri-yatsenko đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
datajoint/datajoint-python#1539 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
datajoint/datajoint-python#1644 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schemaCó thể đã có người làm @dimitri-yatsenko đã nhận 6 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 82/100
datajoint/datajoint-python#1640 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của datajoint/datajoint-python
Issue tương tự
-
type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
push_gh-pages fails on master branch on forksCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởgood first issue infrastructure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
kuznia-rdzeni/coreblocks#1135 ·
-
good first issue server
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation priority: high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
a-lex-s/mealie-telegram-bot#54 ·
Maintainer thường phản hồi trong vòng 1 ngày