You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Datastore queries take a projection parameter, which is a list of the fields to be returned. AFAICT, the API don't expose any way to do any "summary" operations (DISTINCT, COUNT, SUM, etc.) except to pull the values back and munge them client-side.
@pcostell so the parameter group_by of object Query does what I expect, and there is not any interest (speed / efficiency ?) to use GQL SELECT DISTINCT ? Thanks.
@Fkawala -- yes, using group_by on all your projection properties is the exact same as using SELECT DISTINCT IN GQL. (In fact that is how GQL DISTINCT is implemented.
Activity
jgeewax commentedon Oct 22, 2015
@pcostell : Can the API even allow this type of thing using a structured query object ? Or is this only supported via GQL ?
tseaver commentedon Oct 22, 2015
Datastore queries take a
projectionparameter, which is a list of the fields to be returned. AFAICT, the API don't expose any way to do any "summary" operations (DISTINCT,COUNT,SUM, etc.) except to pull the values back and munge them client-side.pcostell commentedon Oct 22, 2015
Sorry OOO so short reply:
Yes it can. In
v1beta2you can usegroup_by, inv1beta3you can usedistinct_on.SELECT DISTINCT p FROM Kind==SELECT p FROM KIND GROUP BY p.Aggregation ops aren't supported because they would require full scans of the data to answer.
DISTINCThowever can be implemented efficiently.Fkawala commentedon Oct 23, 2015
@pcostell so the parameter
group_byof objectQuerydoes what I expect, and there is not any interest (speed / efficiency ?) to use GQLSELECT DISTINCT? Thanks.pcostell commentedon Oct 23, 2015
@Fkawala -- yes, using
group_byon all your projection properties is the exact same as usingSELECT DISTINCTIN GQL. (In fact that is how GQLDISTINCTis implemented.dhermes commentedon Dec 31, 2015
@pcostell I'm closing this out. It seems support already exists. LMK if I'm mistaken.
Language v1 [(#1202)](GoogleCloudPlatform/python-docs-samples#1202)
feat: Add support for Proto and Enum types (#1202)
chore(main): release 0.63.3 (#1202)
feat: Add support for Proto and Enum types (#1202)