apache / apache/iceberg-python

SqlCatalog table operations should filter on `iceberg_type`

Abierto
#3,337 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
1.1k
Forks
581
Merge medio
1 d 17 h
PR fusionados (30 d)
78

Descripción

### 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 :/
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start in the SqlCatalog table-operation methods, compare their predicates with the existing iceberg_type handling in list_tables from #3263, and reproduce the issue with the provided SQLite setup and view row. Done means load_table, drop_table, rename_table, and commit_table no longer treat rows with iceberg_type VIEW as tables, while TABLE and NULL rows continue to work.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python, sql
Área
databases
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
68/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.