[Bug] REST catalog drop_table serializes purgeRequested as "True" instead of "true"
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza en pyiceberg/catalog/rest/init.py, en RestCatalog.drop_table, e inspecciona las otras apariciones de params= sugeridas en el issue. Reproduce la solicitud o ejecuta las comprobaciones relevantes del REST catalog; después, verifica que purgeRequested se serialice como true o false en minúsculas y que el servidor lo acepte.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Apache Iceberg version
None
Please describe the bug 🐞
### Description
`RestCatalog.drop_table()` passes a Python `bool` directly to `requests` query params. Python's `requests` library
serializes `True` as the string `"True"` (capitalized). This violates the OpenAPI 3.0 specification for boolean
query parameters and causes 400 errors on spec-compliant servers.
### Steps to Reproduce
```python
from pyiceberg.catalog import load_catalog
catalog = load_catalog("my_catalog", **{
"type": "rest",
"uri": "http://my-rest-catalog/iceberg",
...
})
catalog.drop_table("my_db.my_table", purge_requested=True)
# → 400 Bad Request
Evidence
Enabled wire-level logging via http.client.HTTPConnection.debuglevel = 1:
send: b'DELETE /iceberg/v1//namespaces/my_db/tables/my_table?purgeRequested=True HTTP/1.1\r\n...'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: x-amzn-errortype: purge_enabled
body: {"error":{"type":"BadRequestException","message":"purge_enabled: DropTable operation failed. OSS Tables only
supports dropping tables with purge enabled."}}
The server receives purgeRequested=True (capital T) and does not interpret it as boolean true.
Root Cause
pyiceberg/catalog/rest/init.py, drop_table method (~line 1135):
def drop_table(self, identifier: str | Identifier, purge_requested: bool = False) -> None:
response = self._session.delete(
self.url(Endpoints.drop_table, prefixed=True, **self._split_identifier_for_path(identifier)),
params={"purgeRequested": purge_requested}, # Python bool True → requests serializes as "True"
)
Python's requests library calls str() on param values: str(True) → "True".
Why This Is a Bug
The Iceberg REST catalog OpenAPI spec (rest-catalog-open-api.yaml
(https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml)) defines purgeRequested as:
- name: purgeRequested
in: query
schema:
type: boolean
Per the specification chain:
- OpenAPI 3.0.3, Parameter Object (https://spec.openapis.org/oas/v3.0.3#parameter-object): query parameters default
to style: form; primitive types are based on "JSON Schema Specification Wright Draft 00" - JSON Schema Wright Draft 00, Section 4.1
(https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-4.1): type: boolean accepts
only JSON boolean literals - RFC 7159 (The JSON Data Interchange Format), Section 3 (https://datatracker.ietf.org/doc/html/rfc7159#section-3):
the only boolean literals are true and false (lowercase)
"True" (capitalized) is not a valid serialization of a JSON boolean.
Suggested Fix
params={"purgeRequested": str(purge_requested).lower()},
Or more explicitly:
params={"purgeRequested": "true" if purge_requested else "false"},
Scope
This pattern may exist elsewhere in the REST catalog client. A grep for params={ in
pyiceberg/catalog/rest/init.py would identify other occurrences where Python bools are passed as query
parameters.
Environment
- PyIceberg: 0.11.1
- Python: 3.10.21
- Server: Aliyun OSS Tables (Iceberg REST compatible, strictly validates boolean query params)
- requests: 2.x (serializes bool via str())
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
- Lenguaje dominante
- Python
- Estrellas
- 1.1k
- Forks
- 589
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 72
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/iceberg-python
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/iceberg-python#3996 ·
-
Deletion vector bitmap count is read from the blob and used as a loop bound without validation Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/iceberg-python#3979 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/iceberg-python#3885 ·
-
[Bug] PyArrowFileIO fails to propagate s3.ssl.ca-cert to pyarrow.fs.S3FileSystem tls_ca_file_path Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/iceberg-python#3866 · 1 comentario ·
-
Cannot connect to a Hive Metastore with Kerberos when the principal's host differs from the URI host Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/iceberg-python#3787 ·
Todos los issues de apache/iceberg-python
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
use-agent-os/agent-os#3314 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
BasedHardware/omi#15662 · 1 comentario ·
-
documentation help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
AiursoftWeb/AnduinOS-2#19 ·