Skip to content

catalog.table_exists() returns 'False' when table exists in Polaris catalog #1363

Description

@JasperHG90

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.

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:

#%%importhttpximportpolarsasplfrompyiceberg.catalogimportload_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.pycatalog=load_catalog(
name="dagster_example_catalog",
)
# %% Create a namespacecatalog.create_namespace("example")
# %% Create data and add to tabledf=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 200catalog_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/tableExistsresp=catalog_client.head(
url="dagster_example_catalog/namespaces/example/tables/table"
)
resp.status_code# 200

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions