- Notifications
You must be signed in to change notification settings - Fork42
Open
Description
Hello,
Sorry I'm not 100% if this should be a bug report or a feature request, but since the IN operator is working on the Datastore UI on the GCP Console I'm guessing it's a bug.
Environment details
I'm not allowed to share those, but I don't think it matters in this case
- OS type and version:
- Python version:
python --version - pip version:
pip --version google-cloud-datastoreversion:pip show google-cloud-datastore
Steps to reproduce
- Try to execute a query on the
__key__property with the IN operator - Error :
ValueError: Invalid key: "[<Key('Kind', 'key'), project=gcp-project>, <Key('Kind', 'key'), project=gcp-project>]"
Code example
query=client.query(kind=kind)query.add_filter("__key__","IN", [client.key(kind,key),client.key(kind,key2)])
Stack trace
# exampleSorry I'm not allowed to share the whole stack trace, but I investigated a bit and it seems to come from this condition :
if property_name == KEY_PROPERTY_NAME and not isinstance(value, Key): raise ValueError('Invalid key: "%s"' % value)In casevalue is aList, it should check that all elements from the list are Keys instead of raising an error
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!