简体   繁体   English

GAE DataStore python-fetch()vs run()

[英]GAE DataStore python - fetch() vs run()

I saw there are two methods for getting data from the datastore: fetch() and run() Regarding fetch the documentation says: Note: You should rarely need to use this method; 我看到有两种从数据存储中获取数据的方法:fetch()和run()关于获取文档的说明:注意:您应该很少需要使用此方法。 it is almost always better to use run() instead. 最好总是使用run()代替。

I don't understand the difference between the two. 我不明白两者之间的区别。 I am new to GAE and Python, please help me understand. 我是GAE和Python的新手,请帮助我理解。 Thanks 谢谢

It says that run() is asynchronous which I don't understand cause unlike JavaScript, once you run the Python script for the site, the html is frozen, right? 它说run()是异步的,与JavaScript不同,我不理解其原因,一旦您为站点运行Python脚本,html就会冻结,对吗?

Beginner's advice: until you appreciate the difference, stick with fetch(). 初学者的建议:直到您了解其中的区别,然后坚持使用fetch()。 There are many other things you probably ought to get comfortable with first before this subtle distinction will bother you. 在这个微妙的区别困扰您之前,您可能还应该先适应许多其他事项。

You can run (with run) multiple datastore queries in parallel to improve latency. 您可以并行运行(带有运行)多个数据存储查询以提高延迟。 This has nothing to do with your resulting HTML. 这与生成的HTML无关。 The resulting HTML should be the same. 结果HTML应该是相同的。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM