在 DataStore 中创建多个 key/value 对
Create multiple key/value pairs in DataStore
我正在使用 Python 和 Google Cloud DataStore,并且有很多 key/value 对要为每个实体存储,如下所示:
键:卧室,值:3
键:GARAGES,值:2
键:独家,值:真
键:EXPIRES,值:2015-05-26
等等
稍后我必须对其进行过滤,例如:获取所有具有 BEDROOMS > 2 和 GARAGES > 1 的实体。
将其存储在 Google 的 DataStore 上的最佳方式是什么?我阅读了有关 data types 的文档,但没有找到一个好的方法。
您可能想要使用 expando class,您可以使用它在运行时存储任意字段。
PS: 检查如何做 query with expando
If your model is an Expando, then your filter can use GenericProperty, the class Expando uses for dynamic properties
Polymodel 也可以,但这取决于你的数据库结构。
我正在使用 Python 和 Google Cloud DataStore,并且有很多 key/value 对要为每个实体存储,如下所示:
键:卧室,值:3
键:GARAGES,值:2
键:独家,值:真
键:EXPIRES,值:2015-05-26
等等
稍后我必须对其进行过滤,例如:获取所有具有 BEDROOMS > 2 和 GARAGES > 1 的实体。
将其存储在 Google 的 DataStore 上的最佳方式是什么?我阅读了有关 data types 的文档,但没有找到一个好的方法。
您可能想要使用 expando class,您可以使用它在运行时存储任意字段。 PS: 检查如何做 query with expando
If your model is an Expando, then your filter can use GenericProperty, the class Expando uses for dynamic properties
Polymodel 也可以,但这取决于你的数据库结构。