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
{{ message }}
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.
I'm just copying the gist of a SO question. In particular, the docs for AppEngine state:
Although a StructuredProperty can be repeated and a StructuredProperty can contain another StructuredProperty, beware: if one structured property contains another, only one of them can be repeated.
This implies that nested structured properties cannot both be repeated. However, the condition in the code appears to be that any repeated property cannot be contained in a repeated StructuredProperty, as doing so will throw something like:
TypeError: This StructuredProperty cannot use repeated=True because its model class (KeyList) contains repeated properties (directly or indirectly).
It may be that the documentation I've quoted at the top are just unclear or I've misread them.
However, if a repeated StructuredProperty ought to be able to contain repeated properties (that are not of the StructuredProperty variety), then the solution might be to change the condition from if modelclass._has_repeated to (something like):
Structured property types can be nested arbitrarily deep, but in a
hierarchy of nested structured property types, only one level can have
the repeated flag set. It is fine to have multiple structured
properties referencing the same model class.
It's not clear if the restriction is intended to be one level of structured property, or the leaf properties can also be repeated.
@jonparrot -- Yup this is a docs issue. Only one layer of repeated properties is allowed in ndb. So a StructuredProperty can be repeated but then none of the properties in that StructuredProperty can be repeated.
I'm just copying the gist of a SO question. In particular, the docs for AppEngine state:
This implies that nested structured properties cannot both be repeated. However, the condition in the code appears to be that any repeated property cannot be contained in a repeated StructuredProperty, as doing so will throw something like:
It may be that the documentation I've quoted at the top are just unclear or I've misread them.
However, if a repeated StructuredProperty ought to be able to contain repeated properties (that are not of the StructuredProperty variety), then the solution might be to change the condition from
if modelclass._has_repeated
to (something like):Cheers
The text was updated successfully, but these errors were encountered: