google-cloud-datastore

AppEngine: Query datastore for records with <missing> value

不羁的心 提交于 2019-11-27 20:30:54
I created a new property for my db model in the Google App Engine Datastore. Old: class Logo(db.Model): name = db.StringProperty() image = db.BlobProperty() New: class Logo(db.Model): name = db.StringProperty() image = db.BlobProperty() is_approved = db.BooleanProperty(default=False) How to query for the Logo records, which to not have the 'is_approved' value set? I tried logos.filter("is_approved = ", None) but it didn't work. In the Data Viewer the new field values are displayed as . According to the App Engine documentation on Queries and Indexes , there is a distinction between entities

Looking for opinions on using Objectify-appengine instead of JDO in GAE-J [closed]

南楼画角 提交于 2019-11-27 20:29:31
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I've been slowly and a bit painfully working my way up the datastore/JDO learning curve in GAE. Recently I've found a framework called Objectify that is supposed to be somewhere between the very-simple Datastore native API and the complex JDO. I've been reading up on it and

How does one get a count of rows in a Datastore model in Google App Engine?

为君一笑 提交于 2019-11-27 20:05:52
I need to get a count of records for a particular model on App Engine. How does one do it? I bulk uploaded more than 4000 records but modelname.count() only shows me 1000. You should use Datastore Statistics : Query query = new Query("__Stat_Kind__"); query.addFilter("kind_name", FilterOperator.EQUAL, kind); Entity entityStat = datastore.prepare(query).asSingleEntity(); Long totalEntities = (Long) entityStat.getProperty("count"); Please note that the above does not work on the development Datastore but it works in production (when published). I see that this is an old post, but I'm adding an

How to clear cache for specific model in NDB

六眼飞鱼酱① 提交于 2019-11-27 18:54:41
问题 I am in the process of transitioning to the NDB, and I am using two model sets: one based in plain old google.appengine.ext.db and one based on new fancy google.appengine.ext.ndb . I would like to use NDB-based models for read-only and retain the caching that's built into NDB, while being able to store changes using the old models (and signal the need to update caches to the NDB when needed). How can I flush/clear cache for a specific model instance in the NDB while saving changes in the

Google App Engine: ImportError: No module named appengine.ext

被刻印的时光 ゝ 提交于 2019-11-27 18:49:23
问题 I am trying to write a test for my GAE programme which uses the datastore. Following Google's Documentation, I see that I should be adding the path to my SDK into my PYTHONPATH. I did this using: import sys sys.path.remove('/usr/local/lib/python2.7/dist-packages') # Has a 'google' module, which I want to be sure isn't interfering. sys.path.insert(1,'/home/olly/google-cloud-sdk/platform/google_appengine') sys.path.insert(1, '/home/olly/google-cloud-sdk/platform/google_appengine/lib/yaml/lib')

Google App Engine HRD - what if I exceed the 1 write per second limit for writing to the entity group?

自古美人都是妖i 提交于 2019-11-27 18:15:52
问题 According to the Google App Engine documentation, writing to one entity group is limited to one write per second when using High Replication Datastore. So... What happens if I exceed this limit? Some kind of exception? And what should I do? How do I know that I'm close to exceeding this limit? I can design the application in a way that particular actions (adding an entity...) are not likely to happen often but naturally I can't guarantee that. 回答1: one write per second is a little low. it

ndb query error with datetime field - Google App Engine

给你一囗甜甜゛ 提交于 2019-11-27 17:56:27
问题 I'm having a problem and I don't find any information about. I define a field in my model like this. class Dates(ndb.model): ... date = ndb.DateTimeProperty(required = True) # I want to store date and time ... Later I try a query (now I want all the dates for a day, I don'tn mind the time): kl = Dates.query(ndb.AND(Dates.date.year == year, Dates.date.month == month, Dates.date.day == day), ancestor = customer.key).fetch(keys_only = True) dates = ndb.get_multi(kl) But I get this error log:

Storing hierarchical data in Google App Engine Datastore?

青春壹個敷衍的年華 提交于 2019-11-27 17:27:51
Can someone illustrate how I can store and easily query hierarchical data in google app engine datastore? The best option depends on your requirements. Here's a few solutions (I'm assuming you're using Python, since you didn't specify): If you need to do transactional updates on an entire tree, and you're not going to have more than about 1QPS of sustained updates to any one tree, you can use the built in support for heirarchial storage. When creating an entity, you can pass the "parent" attribute to specify a parent entity or key, and when querying, you can use the .ancestor() method (or

options for restoring appengine datastore data?

落花浮王杯 提交于 2019-11-27 17:00:52
问题 A user of our application has accidently deleted data. They'd like this to be restored. We have no special logic or datastore entities that can do this. However, we do daily backups of our entire datastore to blobstore using the datastore admin. What are our options for selectively restoring part of this backup back into the datastore? We'd preferably like to not have a service interruption for other users. One final restriction is that we can not change our production app id (i.e. copy data

How to delete all the entries from google datastore?

本小妞迷上赌 提交于 2019-11-27 16:29:54
I created a page to delete all entries from datastore. I am using self.key.delete() for this but it has stopped working (it worked once but it isn't working anymore). My python code to delete entries: class DeletePage(Handler): def get(self): self.key.delete() self.render('deletepage.html') Assuming that: you're using the ndb library you have a models.py file with the entity models Then you can try something like this, hooked up in one of the app's handler: from google.appengine.ext import ndb import inspect import models for kind, model in inspect.getmembers(models): if not isinstance(model,