Skip to content

S3TablesCatalog.has_table returns False on AccessDenied and other non-404 errors #7709

Open

Description

@pcbeingused333

Describe the bug

S3TablesCatalog.has_table returns False for any failure, not just a missing table. An AccessDenied, a throttling error or a network failure therefore looks the same as "this table does not exist", and code that does if not catalog.has_table(t): catalog.create_table(t, ...) goes on to act on a wrong answer.

Cause

daft/catalog/__s3tables.py:

def _has_table(self, identifier: Identifier) -> bool:
    try:
        self._get_table(identifier)
        return True
    except Exception:
        return False

_get_table already separates the two cases: it turns NotFoundException into NotFoundError and re-raises every other ClientError. _has_namespace, just above in the same file, returns False only for NotFoundException and re-raises the rest, so the two methods behave differently.

Proposed fix

Catch only NotFoundError in _has_table, so other errors reach the caller as they already do from _has_namespace and get_table. Add tests in tests/catalog/test_s3tables.py with a mocked client: NotFoundException gives False, AccessDeniedException raises.

This changes behavior (callers that today get False on a permissions error would get an exception), so per CONTRIBUTING I'm asking first. If you're fine with it, I'll open the PR.


Disclosure: this issue was drafted with the help of an AI assistant (Claude); the code reading was done by it and has not been run against a live S3 Tables bucket.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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