[google-appengine] Re: 'run_in_transaction' gives a 'KeyError:

2008-11-07 Thread David Wilson (entertainment cloud)


after some more testing, it only happens in debug with psyco (1.6).

I've removed psyco for now and its all running fine.



On Nov 7, 3:11 pm, "David Wilson (entertainment cloud)"
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> Some how I keep breaking the dev server datastore, so it gives this
> error when try to 'put' anything in a transaction:
>
> class Foo(db.Model):
>     pass
>
> def trans():
>     foo = Foo()
>     foo.put()
>
> class Test(webapp.RequestHandler):
>
>     def get(self):
>         db.run_in_transaction(trans)
>
> File "C:\Program Files\Google\google_appengine\google\appengine\ext\db
> \__init__.py", line 618, in put
>     return datastore.Put(self._entity)
>   File "C:\Program Files\Google\google_appengine\google\appengine\api
> \datastore.py", line 154, in Put
>     tx = _MaybeSetupTransaction(req, keys)
>   File "C:\Program Files\Google\google_appengine\google\appengine\api
> \datastore.py", line 1479, in _MaybeSetupTransaction
>     tx = _txes[tx_key]
> KeyError: 
>
> If I run the code not in a transaction it runs fine.
>
> Anyone know what this is? Im running winxp latest api.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
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
-~--~~~~--~~--~--~---



[google-appengine] 'run_in_transaction' gives a 'KeyError:

2008-11-07 Thread David Wilson (entertainment cloud)


Hi,

Some how I keep breaking the dev server datastore, so it gives this
error when try to 'put' anything in a transaction:

class Foo(db.Model):
pass

def trans():
foo = Foo()
foo.put()

class Test(webapp.RequestHandler):

def get(self):
db.run_in_transaction(trans)


File "C:\Program Files\Google\google_appengine\google\appengine\ext\db
\__init__.py", line 618, in put
return datastore.Put(self._entity)
  File "C:\Program Files\Google\google_appengine\google\appengine\api
\datastore.py", line 154, in Put
tx = _MaybeSetupTransaction(req, keys)
  File "C:\Program Files\Google\google_appengine\google\appengine\api
\datastore.py", line 1479, in _MaybeSetupTransaction
tx = _txes[tx_key]
KeyError: 

If I run the code not in a transaction it runs fine.

Anyone know what this is? Im running winxp latest api.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
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
-~--~~~~--~~--~--~---



[google-appengine] Re: consistent order when sorting on values that are the same?

2008-10-14 Thread David Wilson (entertainment cloud)


ok, thanks, I read that, but wasnt sure.

testing will be the way forward :)



On Oct 14, 7:11 pm, "Barry Hunter" <[EMAIL PROTECTED]>
wrote:
> Possibly best just to try it!
>
> But fromhttp://code.google.com/appengine/docs/datastore/queriesandindexes.html
>
> * In the case of a tie, the key of the entity is used as the tie-breaker.
>
> ... its talking about list fields - but the same code is probably used
> for sort order of non-lists.
>
> On Tue, Oct 14, 2008 at 3:05 PM, David Wilson (entertainment cloud)
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
> > as a note, its fine if it is 3,2,4. as long as its always 3,2,4.
>
> > On Oct 14, 3:00 pm, "David Wilson (entertainment cloud)"
> > <[EMAIL PROTECTED]> wrote:
> >> Another day, another question:
>
> >> Are fetch results returned in a consistent order when sorting on
> >> values that are the same.
>
> >> ie
>
> >> if my models have id 1..4 and values 1,2,2,3 and I perform a filtered
> >> fetch of value >= 2. Will the models always be returned in the order
> >> id 2,3,4?
>
> >> im going to hit a problem if it undefined and could be 3,2,4.
>
> >> thanks.
>
> --
> Barry
>
> -www.nearby.org.uk-www.geograph.org.uk-
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
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
-~--~~~~--~~--~--~---



[google-appengine] Re: consistent order when sorting on values that are the same?

2008-10-14 Thread David Wilson (entertainment cloud)

as a note, its fine if it is 3,2,4. as long as its always 3,2,4.



On Oct 14, 3:00 pm, "David Wilson (entertainment cloud)"
<[EMAIL PROTECTED]> wrote:
> Another day, another question:
>
> Are fetch results returned in a consistent order when sorting on
> values that are the same.
>
> ie
>
> if my models have id 1..4 and values 1,2,2,3 and I perform a filtered
> fetch of value >= 2. Will the models always be returned in the order
> id 2,3,4?
>
> im going to hit a problem if it undefined and could be 3,2,4.
>
> 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 google-appengine@googlegroups.com
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
-~--~~~~--~~--~--~---



[google-appengine] consistent order when sorting on values that are the same?

2008-10-14 Thread David Wilson (entertainment cloud)


Another day, another question:

Are fetch results returned in a consistent order when sorting on
values that are the same.

ie

if my models have id 1..4 and values 1,2,2,3 and I perform a filtered
fetch of value >= 2. Will the models always be returned in the order
id 2,3,4?

im going to hit a problem if it undefined and could be 3,2,4.

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 google-appengine@googlegroups.com
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
-~--~~~~--~~--~--~---



[google-appengine] Re: datastore .order question

2008-10-13 Thread David Wilson (entertainment cloud)


good news all round :) thanks for clearing that up everyone.


On Oct 13, 7:05 pm, yejun <[EMAIL PROTECTED]> wrote:
> It will only pull unnecessary data when you use offset parameter in
> fetch(limit,offset=0). Because when you set an offset, the datastore
> still need to iterate all previous data before that offset.
>
> On Oct 13, 1:25 pm, "David Wilson (entertainment cloud)"
>
> <[EMAIL PROTECTED]> wrote:
> > when you say the same is not true of filter, are you saying that
>
> > Thing.all().filter('value >'  5).get()
>
> > will pull Things 1,2,3,4,5(like the offset issue) the records from the
> > datastore, but just return Things 6 from the query.
>
> > this seems wrong to me.
>
> > The reason im making sure on this is that my Thing has a large Blob in
> > it that i really need to make sure is not getting pulled apart from
> > the ones im displaying at the time. Otherwise i will split up the
> > model and put an id in the Thing to a new model ThingBlob.
>
> > On Oct 13, 5:34 pm, "Marzia Niccolai" <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > The same is not true of filter().  Filter will start at the first value
> > > larger than x, and should be used if you want to paginate your records.
>
> > > Brett Slatkin's IO talk covers scalable pagination recipes, and I suggest
> > > checking it 
> > > out:http://sites.google.com/site/io/building-scalable-web-applications-wi...
>
> > > -Marzia
>
> > > On Mon, Oct 13, 2008 at 6:24 AM, David Wilson (entertainment cloud) <
>
> > > [EMAIL PROTECTED]> wrote:
>
> > > > ok, i wanted to be sure about this, as pulling all the records and
> > > > just returning one would have been a performance disaster for my app.
>
> > > > my question was raised because i was a little surprised to read that
> > > > offset queries still pull all the 'upto' offset out of the store.
>
> > > > does the same apply to Thing.all().filter('value >'  x).get()  ?
>
> > > > and thus is it possible to page without pulling all the previous pages
> > > > data from the store each time?
>
> > > > On Oct 13, 1:01 pm, Sylvain <[EMAIL PROTECTED]> wrote:
> > > > > Only '1'
>
> > > > >http://code.google.com/appengine/docs/datastore/queryclass.html#Query...
>
> > > > > On 13 oct, 13:41, "David Wilson (entertainment cloud)"
>
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > Hi,
>
> > > > > > class Thing(db.Model):
>
> > > > > >     value = db.IntegerProperty(required=True)
>
> > > > > > datastore has 10 Things with value 1..10
>
> > > > > > Question:
>
> > > > > > How many records does the query Thing.all().order('-value').get() 
> > > > > > pull
> > > > > > from the datastore?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
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
-~--~~~~--~~--~--~---



[google-appengine] Re: datastore .order question

2008-10-13 Thread David Wilson (entertainment cloud)


when you say the same is not true of filter, are you saying that

Thing.all().filter('value >'  5).get()

will pull Things 1,2,3,4,5(like the offset issue) the records from the
datastore, but just return Things 6 from the query.

this seems wrong to me.

The reason im making sure on this is that my Thing has a large Blob in
it that i really need to make sure is not getting pulled apart from
the ones im displaying at the time. Otherwise i will split up the
model and put an id in the Thing to a new model ThingBlob.





On Oct 13, 5:34 pm, "Marzia Niccolai" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> The same is not true of filter().  Filter will start at the first value
> larger than x, and should be used if you want to paginate your records.
>
> Brett Slatkin's IO talk covers scalable pagination recipes, and I suggest
> checking it 
> out:http://sites.google.com/site/io/building-scalable-web-applications-wi...
>
> -Marzia
>
> On Mon, Oct 13, 2008 at 6:24 AM, David Wilson (entertainment cloud) <
>
> [EMAIL PROTECTED]> wrote:
>
> > ok, i wanted to be sure about this, as pulling all the records and
> > just returning one would have been a performance disaster for my app.
>
> > my question was raised because i was a little surprised to read that
> > offset queries still pull all the 'upto' offset out of the store.
>
> > does the same apply to Thing.all().filter('value >'  x).get()  ?
>
> > and thus is it possible to page without pulling all the previous pages
> > data from the store each time?
>
> > On Oct 13, 1:01 pm, Sylvain <[EMAIL PROTECTED]> wrote:
> > > Only '1'
>
> > >http://code.google.com/appengine/docs/datastore/queryclass.html#Query...
>
> > > On 13 oct, 13:41, "David Wilson (entertainment cloud)"
>
> > > <[EMAIL PROTECTED]> wrote:
> > > > Hi,
>
> > > > class Thing(db.Model):
>
> > > >     value = db.IntegerProperty(required=True)
>
> > > > datastore has 10 Things with value 1..10
>
> > > > Question:
>
> > > > How many records does the query Thing.all().order('-value').get() pull
> > > > from the datastore?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
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
-~--~~~~--~~--~--~---



[google-appengine] Re: datastore .order question

2008-10-13 Thread David Wilson (entertainment cloud)

ok, i wanted to be sure about this, as pulling all the records and
just returning one would have been a performance disaster for my app.

my question was raised because i was a little surprised to read that
offset queries still pull all the 'upto' offset out of the store.

does the same apply to Thing.all().filter('value >'  x).get()  ?

and thus is it possible to page without pulling all the previous pages
data from the store each time?



On Oct 13, 1:01 pm, Sylvain <[EMAIL PROTECTED]> wrote:
> Only '1'
>
> http://code.google.com/appengine/docs/datastore/queryclass.html#Query...
>
> On 13 oct, 13:41, "David Wilson (entertainment cloud)"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi,
>
> > class Thing(db.Model):
>
> >     value = db.IntegerProperty(required=True)
>
> > datastore has 10 Things with value 1..10
>
> > Question:
>
> > How many records does the query Thing.all().order('-value').get() pull
> > from the datastore?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
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
-~--~~~~--~~--~--~---



[google-appengine] datastore .order question

2008-10-13 Thread David Wilson (entertainment cloud)

Hi,

class Thing(db.Model):

value = db.IntegerProperty(required=True)

datastore has 10 Things with value 1..10

Question:

How many records does the query Thing.all().order('-value').get() pull
from the datastore?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
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
-~--~~~~--~~--~--~---