Skip to content

Catalog fails to load table using the table's identifier #123

Closed
@pdames

Description

@pdames

Apache Iceberg version

main (development)

Please describe the bug 🐞

Reproduction Steps

  1. Load a catalog named test_catalog.
  2. Create a table named test_namespace.test_table table inside of it.
  3. Provide the following variations of this table's identifier to catalog.load_table, and ensure that the 3rd variation using table.identifier fails due to inclusion of the catalog's name (test_catalog) @ table.identifier[0]:
table = catalog.load_table("test_namespace.test_table")  # string identifier works...
table = catalog.load_table(("test_namespace", "test_table"))  # tuple identifier also works...
catalog.load_table(table.identifier)  # pyiceberg.exceptions.NoSuchTableError: NoSuchTableException: Table does not exist: test_catalog.test_namespace.test_table

A more interesting question that I'd like to open for discussion as part of this issue is the best way to fix it. For example, we could argue that the bug lies with catalog.load_table() for not handling the catalog name as part of the identifier. Alternatively, we could argue that table.identifier shouldn't include the catalog name in the first place.

As a workaround in my code for now, I've created a wrapper method for catalog.load_table(identifier) that scrubs the current catalog's name from the given identifier before forwarding it to catalog.load_table(identifier).

Environment Info
Iceberg REST Catalog running in the tabulario/iceberg-rest Docker container w/ a mock S3 Filesystem:

def catalog_properties() -> Dict[str, str]:
    return {
        "type": "rest",
        "uri": "http://localhost:8181",
        "s3.endpoint": "http://localhost:9000",
        "s3.access-key-id": "admin",
        "s3.secret-access-key": "password",
    }
    
load_catalog(name="test_catalog", **catalog_properties())

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