Il giorno venerdì 30 dicembre 2011 19:29:40 UTC+1, Prateek Malhotra ha scritto:
I have no intention in changing parts of Kay's built-in models to NDB, just curious as to the usage of KAY but using NDB for my own models. So far I found I can't create CRUD views for my models, a minor inconvenience but one none-the-less.
Yes, i meant every time Kay uses your models. Forms, CRUD views and when you use custom models for authentication. And any middleware may use your models.
NDB has some strong features that I really like. Most importantly the tasklets. Instead of manually figuring out way to batch my fetch calls, NDB takes care of it for me with little effort on my part. I also think the simplification of functions is good and like the new Query interface although I was fairly used to the old way.
I agree completely.
Working with Expando models is also different now which is probably my only concern.
Expando are very good and I also like the strctured property and the new repeatable flag to manage lists of typed elements. (it's sorta like the kay's forms field).
You can still use get_or_insert or get_by_id for fetching models, and I think using key.get() over db.get(key) is a bit more intuitive in that it gives a clearer view of how the key object differs from the actual entity and is more self-contained.
I still prefer the model.get(key) syntax beacause if another developer reads the code is obvious the model class you will get. I'm little paranoid on code readability :D
But if we have two methods, one on the key object and another on the model, to retrieve it, it's ok!! :)
Happy new Year!,
Paolo