google-cloud-datastore

ndb many to many, retrieve list of one of the relation

为君一笑 提交于 2019-12-12 01:56:01
问题 I've this table class ClubMembership(GCModel): member = ndb.KeyProperty(kind='User', required=True) club = ndb.KeyProperty(kind='Club', required=True) is_active = ndb.BooleanProperty(default=True) membership_type = ndb.StringProperty(choices=set(["MEMBER", "TRAINER", "OWNER"]), default="MEMBER", required=True) Then in the Table Club i've this class Club(GCModel): @property def members(self): return ClubMembership.query(ndb.AND(ClubMembership.club == self.key, ClubMembership.membership_type ==

Google Datastore API from Datalab

泄露秘密 提交于 2019-12-12 01:45:00
问题 I am working with Google's Datalab service, on a Google managed Computer engine(default), and I would like to call my Google Datastore's API. The documentation points to using the from google.appengine.ext import db library. But when I execute this in a datalab code block I get ImportError: No module named appengine.ext . I realize that this likly means that the App Engine SDK is not installed on the Datalab compute engine, My quetion is how can I then access the My Datastore namespace from

No implementation for Kind Exception Python Google App Engine

坚强是说给别人听的谎言 提交于 2019-12-12 01:08:15
问题 I'm trying to access a reference property of an ndb PolyModel subclass from a db Expando subclass. My two classes look like this: class Foo(polymodel.PolyModel): ... class Bar(db.Expando): ... foo_reference = db.ReferecnceProperty(None, collection_name='foos') ... The two definitions are in different files. I assign the reference the following way: ... foo = Foo.query.get() bar.foo_reference = ndb.Key.to_old_key(foo.key) ... I have no problems doing this. I can see the entry stored in the

read each line of a text file using cron schedule

有些话、适合烂在心里 提交于 2019-12-12 00:43:17
问题 I want to use cron schedule to read each line of a text file. cron: - description: read a line of text file url: /read schedule: every 1 minutes But GAE only allow to read a text file without modifying it. How can I make the request read to know that the previous line was already read and it should read the next line. I dont want to store all the read line in datastore and then do query, check if the text line is in datastore or not, bla bla, because I have million of lines. Please advice. I

How to query GAE datastore to render a template (newbie level)

自闭症网瘾萝莉.ら 提交于 2019-12-12 00:02:58
问题 I'm new to programming and I'm trying to grasp the concept of the GAE datastore. I'm trying to build an app to make it easy write contracts (http://contractpy.appspot.com). In the moment, I'm passing all the values I need to render the contract template from URL, this way: self.redirect('/your_contract?person=%s&nacionality=%s&profession=%s&maritalStatus=%s&SSN=%s&driverLicense=%s&email=%s&witness=%s&owner=%s&contractType=%s&address=%s' % (person_name, user_nacionality, user_profession, user

java.util.concurrent.CancellationException while saving Datastore Entities

邮差的信 提交于 2019-12-11 21:37:04
问题 I'm trying to process a big excel file with more than 20K rows. Each row should be saved as an Entity in Datastore. First, I get the excel file in my servlet using the Blobstore and then I queue a task using the Task Queue service. This task, reads the excel file, convert each line in an Entity and store it. As I said before, Excel file could have more than 20K rows. After a while I get this exception: com.xxx.xxx.ProcessBlob doPost: |POST|ProcessBlob|Exception:Task was cancelled.|Msg:Task

How generate datastore-indexes.xml in Google App engine application (Java)

只愿长相守 提交于 2019-12-11 21:35:04
问题 We have a java application and we deployed this on Google App engine. We created around 150 indexes in datastore and which are running fine in production. but somehow we missed indexes information in datastore-indexes-auto.xml and there is no any file with name datastore-indexes.xml. Now we want to have datastore-indexes.xml / datastore-indexes-auto.xml with all existing indexes which serving in production now. How can we do this? I checked appcfg/gcloud commands, there is no any command to

Entity keys are different after migration to High Replication Datastore

人盡茶涼 提交于 2019-12-11 21:11:16
问题 My migration to hrd is not working on appspot.com . The app datastore has 3 "kind"s of data in both the original master/slave (MS) and in the High Replication Datastore (hrd): Group , Pin, and Log. Each Group entity has Pin entities and/or Log entities associated with it, but the associations no longer work in the hrd (which is all that survives the migration), so my app no longer works and I am looking for help to revive it. Below I report the entity keys for the first two Pin entities in

Using App Engine Datastore Low Level API with Java

孤者浪人 提交于 2019-12-11 20:06:54
问题 How to find the total number of entries in an entity type in App Engine Datastore using Low Level API? I there a function or filter to query for this purpose? I am using Java to implement this. 回答1: App Engine has an API for getting datastore statistics programmatically: DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Entity globalStat = datastore.prepare(new Query("__Stat_Total__")).asSingleEntity(); Long totalBytes = (Long) globalStat.getProperty("bytes"); Long

IdGeneratorStrategy unique for each kind

假装没事ソ 提交于 2019-12-11 19:13:00
问题 Is there any way to create a primary key that is only unique inside one specific kind (assuming I am asking the right question here! - apologies if not) I notice there is an "IdentityType.APPLICATION" option but "Application" seems to be the "smallest" available option!! I have the following: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class AuditTrail { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long ID; @Persistent private Date