Tuesday, February 13, 2024

UserWarning: Detected filter using positional arguments. Prefer using the 'filter' keyword argument instead.

If you are receiving that warning with your google datastore queries, you can resolve the it by using google.cloud.datastore.query.PropertyFilter(property_name, operator, value) (docs). The code snippet would be the following:

from google.cloud import datastore
from google.cloud.datastore.query import PropertyFilter

query = datastore.Client().query(kind="MyKind")
query.add_filter(filter=PropertyFilter("property", "=", value))

No comments:

Post a Comment