简体   繁体   English

如何仅用一个键来获取所有数据存储结果?

[英]how to get all the datastore results just with a key?

I am pretty new to Python and GAE. 我对Python和GAE很陌生。 Busy building a simple blog to learn. 忙着建立一个简单的博客来学习。 Was wondering, how can I get the datastore entries? 想知道如何获取数据存储条目?

This is how my DB object looks like : 这就是我的数据库对象的样子:

class BlogArticles(db.Model):
    author = db.UserProperty()
    article_name = db.StringProperty()
    article = db.TextProperty()
    date = db.DateTimeProperty(auto_now_add=True)

Can I get say author and article from passing the key to something like 我可以通过将密钥传递给类似的内容来说作者和文章吗

db.get(key_value)

aah figured it out :) 啊想通了:)

Here is how I did it...so simple. 这是我的操作方法……非常简单。

    all_data = db.get(edit_article)
    article_name = all_data.article_name
    article = all_data.article

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从查询中获取除一个之外的所有结果 - How to get all results from a query except just one 如何获取 json 中某个键的所有值,而不仅仅是最后一组? - How to get all values for a key in the json, not just the last group? 如何在 django-rest-framework 中仅获取主键的结果而不是所有结果? - How to get results of only the primary key and not all results in django-rest-framework? 如何从 XML 获取所有 XPaths,只有键名,没有模板 URL,Python - How to get all XPaths from XML with just key names and no template URLs, with Python 如何在关键字之前获取数字? - How to get numbers just before key words? 最大(*args,关键=...)。 如何修改键以获取某些值? - max(*args, key = ... ). How to modify key to get just certain values? 如何将数据存储中值为 True 的所有属性移动到另一个数据存储? - How to move all attributes in a datastore with value True to another datastore? 如何在没有在Google App Engine中读取数据存储的情况下从实体实例获取引用的实体属性的键名? - How to get to the key name of a referenced entity property from an entity instance without a datastore read in google app engine? 如何从字典键中的一个值获取整个列表? - How to get entire list from just one value in a dictionary key? 如何从更大的字典中获取仅包含键和 GID 的字典? - How to get dictionary with just the key and GIDs from a larger dictionary?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM