Skip to content
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

Async client: Unresolved attribute reference 'execute' for class 'BaseFilterRequestBuilder' #1026

Open
2 tasks done
KBeDevel opened this issue Jan 7, 2025 · 2 comments
Open
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@KBeDevel
Copy link

KBeDevel commented Jan 7, 2025

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Note

This report was created having in consideration the instruction made by @silentworks in the thread https://discord.com/channels/839993398554656828/1323676367765897297.

When using the async client and calling the execute method after an eq filter, PyCharm generate an Unresolved attribute reference 'execute' for class 'BaseFilterRequestBuilder' warning.

Exploring the source of the eq method I figured out the class BaseFilterRequestBuilder doesn't have a definition for the execute method and doesn't extend any class which define it. In fact, there is no definition in the whole "base_request_builder.py" file (PyCharm word search).

On the other hand, the select method is currently defined in AsyncRequestBuilder and returns an instance of AsyncSelectRequestBuilder (which extends AsyncQueryRequestBuilder). This dependency chain correctly provide the execute method definition.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create and async client
from supabase import create_async_client

from app.env import env_vars

supabase = await create_async_client(
  supabase_url=env_vars['SUPABASE_URL'],
  supabase_key=env_vars['SUPABASE_KEY'],
)
  1. Create a select query to any table and schema:
result = await supabase.schema('stuff').table('regs').select().eq('key', key).execute()
  1. PyCharm generate a warning when calling the execute() method

Expected behavior

Call the execute method after eq without a warning.

Screenshots

image

System information

  • OS: GNU/Linux Fedora 41 KDE Workstation
  • Version of supabase: 2.11.0
  • Version of Python: 3.13.0
  • Version of Miniconda: 24.7.1
  • Version of Poetry: 1.8.4 (installed with pipx)

Additional context

Using PyCharm Community 2024.3.1.1 (243.22562.220)

@KBeDevel KBeDevel added the bug Something isn't working label Jan 7, 2025
@silentworks silentworks self-assigned this Jan 7, 2025
@Glinte
Copy link

Glinte commented Jan 8, 2025

Seems to be something about:

# ignoring type checking as a workaround for https://github.com/python/mypy/issues/9319
class AsyncSelectRequestBuilder(BaseSelectRequestBuilder[_ReturnT], AsyncQueryRequestBuilder[_ReturnT]):  # type: ignore

where type checkers PyCharm only pick up on the first parent, and could not find execute() there

This is extremely annoying because my whole repo is drowned by warnings from .execute()/maybe_single()/single() and I can't see actual warnings from a glance. Maybe I should go back to VSCode...

Relevant JetBrains YouTrack issue: https://youtrack.jetbrains.com/issue/PY-52886/Incorrect-Unresolved-attribute-reference-when-using-multiple-inheritance

@Glinte
Copy link

Glinte commented Jan 8, 2025

Workaround: Install mypy or pyright, use their language server, and disable PyCharm's builtin "unresolved references" inspection
image

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

3 participants