google-cloud-datastore

Between query equivalent on App Engine datastore?

喜夏-厌秋 提交于 2019-12-21 05:10:48
问题 I have a model containing ranges of IP addresses, similar to this: class Country(db.Model): begin_ipnum = db.IntegerProperty() end_ipnum = db.IntegerProperty() On a SQL database, I would be able to find rows which contained an IP in a certain range like this: SELECT * FROM Country WHERE ipnum BETWEEN begin_ipnum AND end_ipnum or this: SELECT * FROM Country WHERE begin_ipnum < ipnum AND end_ipnum > ipnum Sadly, GQL only allows inequality filters on one property, and doesn't support the BETWEEN

Google App Engine local datastore path configuration

拜拜、爱过 提交于 2019-12-21 04:41:02
问题 Sorry for asking the nth permutation of this question, but i'm stymied. I'm running GAE for python2.5 on OS X, and i'm losing all data between reboots. From what I understand from related SO posts, the default location for local datastore file is wiped with each reboot. I have tried changing the location to a central /datastores directory with: dev_appserver.py --datastore_path=/Users/Me/gae_apps/datastores /Users/Me/gae_apps/app_1 which doesn't generate an error, but when i fire up dev

How do I unlock the app engine database when localhost runs?

拥有回忆 提交于 2019-12-21 04:26:12
问题 Right now I get a blank page when localhost runs, but the deployed app is fine. The logs show the "database is locked". How do I "unlock" the database for localhost? 回答1: This can happen if you're running multiple instances of dev_appserver without giving them distinct datastore files/directories. If you need to be running multiple instances, see dev_appserver.py --help and look at the options for specifying paths/files. 回答2: Dave W. Smith has the right idea. I had this same issue and looking

Objectify doesn't store synchronously, even with now

我只是一个虾纸丫 提交于 2019-12-21 02:43:17
问题 My servlet should perform the following : when a user registers at a venue, I check whether he's currently registered somewhere (even if it is the same venue) if so, unregister him and to register him once again. I have the following code, which I've simplified in order to show my problem : Date tempDate = new Date(); Visit v = ofy().load().type(Visit.class) .filter(Visit.USER_ID, 5L) .filter(Visit.EXIT_DATE, null).first().get(); if(v != null) exitVenue(5L, 7L, tempDate); Visit visit = new

Use the Datastore (NDB), the Search API or both for views on data?

霸气de小男生 提交于 2019-12-21 02:14:12
问题 In a CMS, a list of customers is retrieved using a regular NDB query with ordering. To allow filtering on name, company name and email, I create several (sometimes many) indices. The situation was not ideal, but workable. Now there's the (experimental) Search API. It seems to have no relation to the datastore (or NDB), but my data is already there. I'd like to use Full Text Search and put filters on multiple fields simultaniously, so should I keep my data in the Datastore and duplicate parts

Google App Engine timeout: The datastore operation timed out, or the data was temporarily unavailable

我怕爱的太早我们不能终老 提交于 2019-12-20 20:36:54
问题 This is a common exception I'm getting on my application's log daily, usually 5/6 times a day with a traffic of 1K visits/day: db error trying to store stats Traceback (most recent call last): File "/base/data/home/apps/stackprinter/1b.347728306076327132/app/utility/worker.py", line 36, in deferred_store_print_statistics dbcounter.increment() File "/base/data/home/apps/stackprinter/1b.347728306076327132/app/db/counter.py", line 28, in increment db.run_in_transaction(txn) File "/base/python

looking for ideas/alternatives to providing a page/item count/navigation of items matching a GAE datastore query

点点圈 提交于 2019-12-20 12:38:39
问题 I like the datastore simplicity, scalability and ease of use; and the enhancements found in the new ndb library are fabulous. As I understand datastore best practices, one should not write code to provide item and/or page counts of matching query results when the number of items that match a query is large; because the only way to do this is to retrieve all the results which is resource intensive. However, in many applications, including ours, it is a common desire to see a count of matching

GAE NDB Datastore new feature: Access Datastore entities from other GAE app

对着背影说爱祢 提交于 2019-12-20 11:01:10
问题 Reading the new documentation of GAE NDB Datastore: https://cloud.google.com/appengine/docs/python/ndb/modelclass#class_methods get_by_id(id, parent=None, app=None, namespace=None, **ctx_options) Returns an entity by ID. This is really just a shorthand for Key(cls, id).get() . Arguments id A string or integer key ID. parent Parent key of the model to get. app (keyword arg) ID of app. If not specified, gets data for current app. namespace (keyword arg) Namespace. If not specified, gets data

Improve App Engine performance by reducing entity size

泪湿孤枕 提交于 2019-12-20 10:46:42
问题 The objective is to reduce the CPU cost and response time for a piece of code that runs very often and must db.get() several hundred keys each time. Does this even work? Can I expect the API time of a db.get() with several hundred keys to reduce roughly linearly as I reduce the size of the entity? Currently the entity has the following data attached: 9 String, 9 Boolean, 8 Integer, 1 GeoPt, 2 DateTime, 1 Text (avg size ~100 bytes FWIW), 1 Reference, 1 StringList (avg size 500 bytes). The goal

Most Efficient One-To-Many Relationships in Google App Engine Datastore?

柔情痞子 提交于 2019-12-20 10:43:53
问题 Sorry if this question is too simple; I'm only entering 9th grade. I'm trying to learn about NoSQL database design. I want to design a Google Datastore model that minimizes the number of read/writes. Here is a toy example for a blog post and comments in a one-to-many relationship. Which is more efficient - storing all of the comments in a StructuredProperty or using a KeyProperty in the Comment model? Again, the objective is to minimize the number of read/writes to the datastore. You may make