JasperHG90 opened a new issue, #1363:
URL: https://github.com/apache/iceberg-python/issues/1363

   ### Apache Iceberg version
   
   0.8.0 (latest release)
   
   ### Please describe the bug 🐞
   
   Hi 👋 
   
   I see quite a few issues/PRs centered around the `table_exists()` method 
when using REST catalogs, e.g.
   
   - https://github.com/apache/iceberg-python/pull/1096
   - https://github.com/apache/iceberg-python/issues/1018
   - https://github.com/apache/iceberg-python/issues/1006
   - https://github.com/apache/iceberg-python/issues/735
   
   When using Polars OSS, I also experience issues with this method. Even 
though a table exists the `catalog.table_exists()` method will return 'False'.
   
   I have a devcontainer setup that you can find 
[here](https://github.com/JasperHG90/dagster-pyiceberg-example-polaris) for the 
example below if that helps.
   
   Python code:
   
   ```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
   tables = 
catalog_client.get(f"dagster_example_catalog/namespaces/example/tables").json()
   
   resp = catalog_client.head(
       url="dagster_example_catalog/namespaces/example/tables/table"
   )
   
   resp.status_code # 200
   ```


-- 
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: issues-unsubscr...@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to