apache / apache/iceberg-python
SqlCatalog table operations should filter on `iceberg_type`
- 主要語言
- Python
- 星號
- 1.1k
- 分支
- 581
- 平均合併
- 1 天 13 小時
- 30 天內合併 PR
- 76
描述
### Feature Request / Improvement
In #3263, the `iceberg_type` column was added to the SQLCatalog and filters it in `list_tables`, but the other table operations (i.e. load_table, drop_table, rename_table, commit_table) don't check it yet. That means a view row written by iceberg java or iceberg-rust can bleed in pythons SQLCatalog table operations.
Java's V1 catalog applies `WHERE (iceberg_type = 'TABLE' OR iceberg_type IS NULL)` everywhere ([JdbcUtil.java#L168](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/jdbc/JdbcUtil.java#L168)). We should do the same.
Probably worth extracting a small helper since the predicate would now appear in ~5+ places.
Repro steps:
```python
catalog = SqlCatalog("test", uri="sqlite:///...", warehouse="...")
catalog.create_namespace("ns")
# bypass and sim java/rust writing a view row
with catalog.engine.connect() as conn:
conn.execute(text(
"INSERT INTO iceberg_tables VALUES "
"('test', 'ns', 'a_view', 's3://fake/m.json', NULL, 'VIEW')"
))
conn.commit()
catalog.drop_table(("ns", "a_view")) # Silently deletes the view row :/
```
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
從 SqlCatalog 的資料表操作方法著手,將它們的述詞與 #3263 中 list_tables 現有的 iceberg_type 處理進行比較,並使用提供的 SQLite 設定和檢視表資料列重現此問題。完成標準是:load_table、drop_table、rename_table 和 commit_table 不再將 iceberg_type VIEW 的資料列視為資料表,同時 TABLE 和 NULL 資料列仍能正常運作。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python, sql
- 領域
- databases
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 68/100