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

Warnings about filters using positional arguments #47

Closed
joakimnordling opened this issue Oct 9, 2023 · 1 comment · Fixed by #61
Closed

Warnings about filters using positional arguments #47

joakimnordling opened this issue Oct 9, 2023 · 1 comment · Fixed by #61

Comments

@joakimnordling
Copy link
Contributor

When you run the tests you get couple of warnings about filters using positional arguments:

  /Users/xxx/Library/Caches/pypoetry/virtualenvs/firedantic-526ElIO_-py3.9/lib/python3.9/site-packages/google/cloud/firestore_v1/base_collection.py:290: UserWarning: Detected filter using positional arguments. Prefer using the 'filter' keyword argument instead.
    return query.where(field_path, op_string, value)

firedantic/tests/tests_async/test_model.py::test_find
  /Users/xxx/yyy/firedantic/firedantic/_async/model.py:150: UserWarning: Detected filter using positional arguments. Prefer using the 'filter' keyword argument instead.
    query: AsyncQuery = query.where(field, f_type, value[f_type])  # type: ignore

firedantic/tests/tests_sync/test_model.py::test_find
  /Users/xxx/yyy/firedantic/firedantic/_sync/model.py:148: UserWarning: Detected filter using positional arguments. Prefer using the 'filter' keyword argument instead.
    query: BaseQuery = query.where(field, f_type, value[f_type])  # type: ignore
@JamesHutchison
Copy link

Coming from here:

    def where(
        self,
        field_path: Optional[str] = None,
        op_string: Optional[str] = None,
        value=None,
        *,
        filter=None,
    ) -> QueryType:
   ...
            return query.where(field_path, op_string, value)  <--- warning is here
        else:
            return query.where(filter=filter)

Looks like they want people to switch to the filter kwarg

@fbjorn fbjorn linked a pull request Feb 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants