简体   繁体   中英

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; it is almost always better to use run() instead.

I don't understand the difference between the two. I am new to GAE and Python, please help me understand. 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?

Beginner's advice: until you appreciate the difference, stick with 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. The resulting HTML should be the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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