Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug] REST catalog drop_table serializes purgeRequested as "True" instead of "true"

Aperta Adatta ai principianti
#3,836 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api

Direzione di ricerca

Inizia in pyiceberg/catalog/rest/init.py, in RestCatalog.drop_table, e analizza le altre occorrenze di params= suggerite nell’issue. Riproduci la richiesta oppure esegui i controlli pertinenti del REST catalog, quindi verifica che purgeRequested venga serializzato come true o false in minuscolo e che il server lo accetti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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:

"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
Lingua principale
Python
Stelle
1.1k
Fork
589
Merge medio
2g 2h
PR unite (30g)
70

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/iceberg-python

Tutte le issue di apache/iceberg-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.