[google-appengine] Re: NDB dictionary

2017-01-23 Thread Vitaly Bogomolov
> If I delete the entity 'West Coast' station entity, will all existing > shifts with "ancestor == ndb.Key(Station, 'West Coast')" automatically get > deleted? > > GAE Datastore don't have any automatic triggers. You can create your own triggers and remove redundant records. Google for "GAE

[google-appengine] Re: NDB dictionary

2017-01-23 Thread Ryan Ang Wei En
Thank you for the help, I am learning a lot today! If I delete the entity 'West Coast' station entity, will all existing shifts with "ancestor == ndb.Key(Station, 'West Coast')" automatically get deleted? I want to prevent data store leaks. -- You received this message because you are

[google-appengine] Re: NDB dictionary

2017-01-22 Thread Vitaly Bogomolov
Hi, Ryan. > I'm working on a server project for a petrol station company. > I have this station class. > > class Station(modelpy.Model): > shifts = ndb.JsonProperty() > > The Station's key's id is the name of a station. > Here are the names of the actual stations: "West Coast", "Woodlands",

[google-appengine] Re: NDB dictionary

2017-01-22 Thread Vitaly Bogomolov
> > Then, access to shifts: > > west_coast_shifts = Station.query(ancestor=ndb.Key(Station, 'West Coast')) > oops west_coast_shifts = Shifts.query(ancestor=ndb.Key(Station, 'West Coast')) -- You received this message because you are subscribed to the Google Groups "Google App Engine" group.

[google-appengine] Re: NDB dictionary

2017-01-21 Thread Ryan Ang Wei En
Dear Anons, First of all thank you for the replies, your care is greatly, greatly appreciated! > # one item into ndb > apple_count = len(Fruit.query().fetch(100)) > self.assertEqual(apple_count, 1) > After reading this, I've realised that fruits analogy is a wrong example of the actual issue

[google-appengine] Re: NDB dictionary

2017-01-20 Thread Richard Cheesmar
use a pre put hook to do your checking: class Fruit(ndb.Model): name = ndb.StringProperty(required=True) color = ndb.StringProperty(required=True) taste = ndb.StringProperty(required=True) def _pre_put_hook(self): On Thursday, January 19, 2017 at 5:39:56 AM UTC+2,

[google-appengine] Re: NDB dictionary

2017-01-19 Thread Vitaly Bogomolov
Hi Ryan Ang Wei En class Fruit(ndb.Model): > name = ndb.StringProperty(required=True) > color = ndb.StringProperty(required=True) > taste = ndb.StringProperty(required=True) > Dont use a 'name' field for ID. There is a 'id' keyword for this purpose. ... class Fruit(ndb.Model): color