datastore

Getting entity's id inside a transaction

别等时光非礼了梦想. 提交于 2019-12-11 03:47:46
问题 I have a datastore transaction where I create an entity (a user) letting datastore generate the ID for me. I then would like to use that ID so that I can create another entity (of another kind). While this is possible with regular datastore 'save' api: datastore.save(user).then(() => { userId = user.key.id // returns entity's ID created by datastore }) However, this does not seem possible when using a transaction: transaction.save(user).then(() => { console.log( user.key.id ) }) The above

How to debug an application without using an IDE and without understanding of the program flow?

白昼怎懂夜的黑 提交于 2019-12-10 20:32:05
问题 I'm trying to modify the code of naive bayes classifier provided by the excellent book Programming Collective Intelligence, adapting it to the GAE datastore (the provided code uses pysqlite2). But trying to do it, I'm encountering an error difficult to debug. The error is this: File "C:\Users\CG\Desktop\Google Drive\Sci&Tech\projects\naivebayes\main.py", line 216, in post sampletrain(nb) File "C:\Users\CG\Desktop\Google Drive\Sci&Tech\projects\naivebayes\main.py", line 201, in sampletrain cl

Is there any limit for the local datastore running Google App Engine Python?

妖精的绣舞 提交于 2019-12-10 19:40:00
问题 I have a simple model: class MyEntry(db.Model): keyName = db.StringProperty() valuesList = db.StringListProperty() and I want to populate the datastore with about 7000 instances of this entity from a file. (I have a function that reads from the file, creates the entities and puts them to the db) I'm using the Interactive Console from the SDK Console to do the exporting (or better, the instantiation). However, even when I try to export the instances in batches of 400, after 1000 instances are

MongoDB : Can the Data Store be used again in another different Mongo Server?

ぃ、小莉子 提交于 2019-12-10 11:48:34
问题 I'm a newbie in MongoDB. Please help to suggest whether it is possible, if i COPY the Data Store (Data Directory) of a MongoDB Instance (from 1 Server), onto another different MongoDB Server. Which means, if i start another MongoDB Server by using the Data Store (Files) from another Server, will everything still work (especially the Data inside). Or Is there such a thing that, this Data Store must be operated by its original Server only? 回答1: There is no problem with migrating the mongo data

Appengine - Upgrading from standard DB to NDB - ReferenceProperties

那年仲夏 提交于 2019-12-08 23:51:46
问题 I have an AppEngine application that I am considering upgrading to use the NDB database. In my application, I have millions of objects that have old-style db references. I would like to know what the best migration path would be to get these ReferenceProperty values converted to KeyProperty values, or any other solution that would allow me to upgrade to NDB. (I am hoping for something that doesn't involve massive batch processing of all of the elements in the database and computing the

How to shallow copy app engine model instance to create new instance?

你说的曾经没有我的故事 提交于 2019-12-08 10:32:36
问题 I want to implement a simple VersionedModel base model class for my app engine app. I'm looking for a pattern that does not involve explicitly choosing fields to copy. I am trying out something like this, but it is to hacky for my taste and did not test it in the production environment yet. class VersionedModel(BaseModel): is_history_copy = db.BooleanProperty(default=False) version = db.IntegerProperty() created = db.DateTimeProperty(auto_now_add=True) edited = db.DateTimeProperty() user = db

Sencha Touch JSONP Store Data not showing up in Panel

纵然是瞬间 提交于 2019-12-08 04:57:07
问题 I've got my sencha-touch app wired up as I believe it should be, and when I load it into Chrome, the Javascript console doesn't throw any errors. The WebService is finally returning the appropriate data, yet for some reason I can't for the life of me figure out why the panel is blank. Here's the APP URL http://rpcm.infinitas.ws/ Here's the WebService URL http://rpc.infinitas.ws/Vimeo/Read?_dc=1308083451839&limit=25&callback=stcCallback1001 And here is some relevant code. CONTROLLER rpc

How to fetch all entities in App engine datastore?

烂漫一生 提交于 2019-12-07 17:31:58
问题 in http://code.google.com/appengine/docs/python/datastore/entities.html#Saving_Getting_and_Deleting_Entities the batch operation for getting the entity are stated below: A batch get. entities = db.get([k1, k2, k3]) How can I fetch all entities without supplying keys? 回答1: I got a solution on this and can be found in Datastore Queries - Query interface example: Query q = new Query("Person") PreparedQuery pq = datastore.prepare(q); for (Entity result : pq.asIterable()) { String firstName =

Appengine datastore not updating multiple records

核能气质少年 提交于 2019-12-07 03:51:27
votergroup = db.GqlQuery("SELECT * FROM Voter WHERE lastname = :1", 'AGEE') for voter in votergroup: voter.email = 'testemail@testemail.com' db.put(votergroup) The above code doesn't seem to be updating the records as it shows in the appengine documentation. I also tried using a query object to no avail. I know votergroup is pulling records, because I did a count on the object when debugging and it showed 10 records. In fact, before the db.put, I looped through voter.email, and it seems like the variable was set. However, the change never seems to make it back to the db. Does anyone know what

Updating a large number of entities in a datastore on Google App Engine

…衆ロ難τιáo~ 提交于 2019-12-07 01:45:04
问题 I would like to perform a small operation on all entities of a specific kind and rewrite them to the datastore. I currently have 20,000 entities of this kind but would like a solution that would scale to any amount. What are my options? 回答1: Use a mapper - this is part of the MapReduce framework, but you only want the first component, map, as you don't need the shuffle/reduce step if you're simply mutating datastore entities. 回答2: Daniel is correct, but if you don't want to mess up with the