@Brandon

You are correct, I really care about the order of the records when
retrieving them, so I guess my question should have been "Is the result
order of a query consistent with the put order".

I know I can use DateTime (or Date in Java), but I always need these
Entities in a specific order and was just trying to avoid using the sort.

Thanks for your feedback and especially the humorous example :-)

On Tue, May 17, 2011 at 6:31 PM, Brandon Wirtz <[email protected]> wrote:

> Order often matters.  (I don't know about the context of this app)
>
> Say you are 4th Bank Of Brandon
>
> You process transactions from your customer Strom
>
> Strom has $500 in his account.
>
> Strom hits the Che Target for $450, Cylon's Coffee Shop for $6, the Hair
> Stylist for $50, and Google bills him for each of his for App Engine
> Accounts at $9 each.
>
> Because of the way the bank does caching Strom could make any purchase in a
> 4 hour window up to $600 ($500 plus his $100 overdraft protection)
>
> If we process the charges in the above order, 4BoB charges Strom $35 over
> draft on the last 5 trans actions.
> If we process the charges in the reverse order 4BoB only gets one over
> draft.
> Depending on the order you can have anywhere from 1 to 6 overdrafts when
> the
> daily fee assessment task runs and determines how much Strom owes.
>
> Yes if we put the time stamp in it shouldn't matter which order the items
> were added to the table...  Which is likely the bit that Erick needed. (BTW
> Erick you are both Eric with a C and a K so I'd have thought you'd have
> gotten the redundancy I'm going to explain next...
>
> When you store data that will need to be ordered add the auto DateTime to
> it.  Or the Time the thing took place, like my bank example someone may
> have
> made a purchase on Tuesday that doesn't show up until Thursday and you'd
> want both when you got the transaction and when it happened.
>
> Then sort the returned date by the DateTime, (or that other time thing we
> just discussed) then do whatever you were going to do with the data.
>
> Don't do this...
>
> Strom has
>
> $500
> -450
> = 50
>
> Google sends 4 requests for $9 in 3 seconds
>
> 50-9 = 41
> 50-9=41
> 41-9=32
> 32-9=23
>
> And you missed $9 because you processed each trans action rather than
> batching a lot of transactions but only using data older than a certain
> amount, and without flagging said data as "processed".
>
>
>
>
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Strom
> Sent: Tuesday, May 17, 2011 3:55 PM
> To: Google App Engine
> Subject: [google-appengine] Re: Is the order of datastore puts guaranteed?
>
> First, the context needs to be a transaction, otherwise there isn't even a
> guarantee that all puts will happen.
> Even inside a transaction though, why does the order matter? I can only
> think of a situation where you use system generated ids, but those aren't
> guaranteed to be in order anyway.
>
> On May 17, 10:02 pm, Erick Fleming <[email protected]> wrote:
> > Within the context of an Entity group, can I guarantee that puts will
> > be in the order I put them?
> >
> > Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to