I have made a registration form for a blog I made using Google Datastore, and now I an trying to make it better.
First thing I seen that can be changed is the way that web application looks for the username in the data store, to see is the username already used.
I did it this way:
db.GqlQuery("SELECT * FROM UserData where username = :1", username)
Can you please refer me to better solution, which will be faster.
Thank you.
If the usernames are unique, then you can make the username the key, in which you can use a db.Model.get_by_key_name()
Actually, for even better performance, use ndb, which caches your entities for get requests, so it'll be even faster.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With