GeezerVison is showing github.com — gcloud.datastore should allow explicit specification of whether the field is indexed · Issue #83 · googleapis/google-cloud-python
gcloud.datastore should allow explicit specification of whether the field is indexed #83DescriptionSummary
Right now, everything is indexed by default (based on the Value protobuf's indexed [default = true] field). See https://github.com/GoogleCloudPlatform/google-cloud-datastore/blob/v1beta2-rev1-2.1.0/proto/datastore_v1.proto#L129
This will get crazy expensive. We need to allow people to specify whether a field should be indexed. We should probably also default this to false. But that's a bigger question.
To do
- Decide whether to allow explicit indexing or unindexing
- Figure out what the syntax will be for specifying indexing
- Submit a patch for the feature
Options for specifying indexing
List of indexed fields
Unless a field is explicitly in the list of indexed fields, the indexed property will be set to False.
entity = ...
entity.indexed_fields = ['field1', 'field2']
List of unindexed fields
If a field is in this list, it's indexed property will be set to False. Otherwise it will be left unset (and therefore default to True per the protobuf definition.
entity = ...
entity.unindexed_fields = ['field1', 'field2']
CC
@proppy @aliafshar Activitypcostell commented on Aug 5, 2014 Pending some work by kdo@, this may not be necessary (and actually we may prefer not to expose this here). dhermes commented on Oct 19, 2014 pcostell commented on Oct 20, 2014 Still a work in progress. For exposing indexed, I would recommend instead exposing it as it will be in the next Cloud Datastore release, exclude_from_indexes (the opposed of indexed). It's more verbose, but makes it more clear that this removes the property from both built-in and composite indexes. This field should really only be used for implementing sparse indexes or for values which cannot be indexed (i.e. large blobs). added this to the This milestone has been deleted milestone on Oct 20, 2014silvolu commented on Oct 29, 2014 In gcloud-node, we implemented @pcostell suggestion: for each property you can pass an excludeFromIndexes; if present, we negate the value an pass it as value for indexed. I think we should do the same here. tseaver commented on Oct 29, 2014 It's tricky here, as we just map an Entity as a dict: there is really no obvious place to store the policy. I guess we could add an 'exclude_from_indexes' attribute to Entity (a set of names?), and then have the marshalling code look at that attribute to decide whether / how to set the protobuf indexed field. silvolu commented on Oct 29, 2014 Sounds good. Basically the 2nd option proposed by @jgeewax, using exclude_from_indexes as the name for the property. added a commit that references this issue on Nov 4, 2014This issue will close once commit df05a0e is merged into the 'main' branch.df05a0e modified the milestones: This milestone has been deleted, This milestone has been deleted on Jan 30, 2015added 5 commits that reference this issue on Nov 24, 2025This issue will close once commit d36f03f is merged into the 'main' branch.d36f03f This issue will close once commit f4e09e0 is merged into the 'main' branch.f4e09e0 This issue will close once commit 502077f is merged into the 'main' branch.502077f This issue will close once commit 754eb1f is merged into the 'main' branch.754eb1f This issue will close once commit 304ed9f is merged into the 'main' branch.304ed9f
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|