Closed
Description
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.
- Fix
table_exists
behavior in REST catalog #1096 - Adjust the "table_exists" behavior in the REST Catalog #1018
- pyiceberg always return false for catalog.table_exists when used with Polaris catalog #1006
- Rest Catalog: table_exist does not succeed on 204 response code #735
When using Polaris 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 to make the example below reproducible.
Python code:
#%%
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
Metadata
Metadata
Assignees
Labels
No labels