JasperHG90 opened a new issue, #471:
URL: https://github.com/apache/polaris/issues/471

   ### Is this a possible security vulnerability?
   
   - [X] This is NOT a possible security vulnerability
   
   ### Describe the bug
   
   The 'check if table exists' catalog 
[endpoint](https://polaris.apache.org/in-dev/unreleased/rest-catalog-open-api/#tag/Catalog-API/operation/tableExists)
 returns status code <200>. The API docs indicate that it should return status 
code <204>. I initially posted this as a bug in the [PyIceberg 
repository](https://github.com/apache/iceberg-python/issues/1363#issuecomment-2495556035).
   
   ### To Reproduce
   
   Here's the script I posted in the PyIceberg issue
   
   ```python
   #%%
   
   import httpx
   import polars as pl
   from pyiceberg.catalog import load_catalog
   
   # Assumes this catalog exists and credentials stored in
   #  .pyiceberg.yaml
   # Possibly created using 
https://github.com/JasperHG90/dagster-pyiceberg-example-polaris/blob/main/scripts/set_up_catalog.py
   catalog = load_catalog(
       name="dagster_example_catalog",
   )
   
   # %% Create a namespace
   
   catalog.create_namespace("example")
   
   # %% Create data and add to table
   
   df = pl.from_dict({
       "a": [1, 2, 3],
       "b": [4, 5, 6]
   }).to_arrow()
   
   catalog.create_table(
       identifier="example.table",
       schema=df.schema
   )
   
   # %% This will return 'False'
   
   catalog.table_exists("example.table")
   
   # %% But querying the 'table exists' Polaris endpoint  returns 200
   
   catalog_client = httpx.Client(
       base_url="http://polaris:8181/api/catalog/v1";,
       headers={
           "Authorization": "Bearer principal:root;realm:default-realm",
           "Content-Type": "application/json",
       }
   )
   
   # See endpoint here: 
https://polaris.apache.org/in-dev/unreleased/rest-catalog-open-api/#tag/Catalog-API/operation/tableExists
   resp = catalog_client.head(
       url="dagster_example_catalog/namespaces/example/tables/table"
   )
   
   resp.status_code # 200
   ```
   
   This should work with any Polaris instance I suppose. The devcontainer that 
I use can be found 
[here](https://github.com/JasperHG90/dagster-pyiceberg-example-polaris/tree/main/.devcontainer).
   
   ### Actual Behavior
   
   It returns a <200> status code.
   
   ### Expected Behavior
   
   It should return a <204> status code.
   
   ### Additional context
   
   N/A
   
   ### System information
   
   Ubuntu 22.04 LTS
   Polars SHA: 
[017ebbc](https://github.com/apache/polaris/tree/017ebbc6eeb76239a169079cb6c3d99e725ceb22)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to