Skip to content

Insert into non-existing table raises empty APIErrror #901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bukacdan opened this issue Aug 18, 2024 · 2 comments
Closed

Insert into non-existing table raises empty APIErrror #901

bukacdan opened this issue Aug 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@bukacdan
Copy link

Insert into non-existing table raises empty APIErrror

Description

If client.table("table_name") does not exist (e.g. typo), insert and upsert operations raise empty APIError.

To Reproduce

  1. Create reference to non-existing table
  2. Attempt to insert data
  3. Raises empty error with no information provided.
 def __init__(self, client: AsyncClient, user: AuthUser):
        self.client = client
        self.repository = self.client.table("not_existing_table")
        self.user = user

        try:
            insert_response = await self.repository.upsert(
                [mod.dict() for mod in db_models],
                count=CountMethod.exact,
                on_conflict="id",
                default_to_null=False,
            ).execute()
        except APIError as e:
            logger.error(f"Failed to bulk insert", user=self.user.id, **e.__dict__)
            # HERE the error is empty

Expected behavior

The error should contain information about the table not present in the scheme.

Screenshots

Screenshot 2024-08-18 at 23 36 41

System information

  • OS: macOS
  • Version of supabase-py: ^2.6.0
@bukacdan bukacdan added the bug Something isn't working label Aug 18, 2024
@silentworks
Copy link
Contributor

The library doesn't give any information beyond what PostgREST which is the underlying server gives. This change would need to be suggested to the PostgREST repo https://github.com/PostgREST/postgrest.

@silentworks
Copy link
Contributor

Closing this as it's a PostgREST issue and not a Supabase Python library issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants