2

I have a collection of Entities of one kind. I need to extract the distinct values of one property, named p, of these Entities.

In GQL, I would do:

SELECT DISTINCT p from kind

However in the gcloud-python library GQL queries aren't implemented yet (see issue-304).

How should I do that with the tools currently available in gcloud-python ? I'm aware of a "group-by" workaround, yet the performances are terrible.

bossylobster
  • 9,993
  • 1
  • 42
  • 61
François Kawala
  • 436
  • 3
  • 18

1 Answers1

2

gcloud-python currently doesn't provide a way for you to do a string GQL query (source), however it seems you can use the group_by field in the Cloud Datastore API to accomplish the same thing.

References:

JJ Geewax
  • 10,342
  • 1
  • 37
  • 49