gae-datastore

Query for model by key

What I'm trying to do is query the datastore for a model where the key is not the key of an object I already have. Here's some code: class User(db.Model): partner = db.SelfReferenceProperty() def text_message(self, msg): user = User.get_or_insert(msg.sender) if not user.partner: # user doesn't have a partner, find ...

How to best design a date/geographic proximity query on GAE?

Hi all, I'm building a directory for finding athletic tournaments on GAE with web2py and a Flex front end. The user selects a location, a radius, and a maximum date from a set of choices. I have a basic version of this query implemented, but it's inefficient and slow. One way I know I can improve it is by condensing the many individual ...

What is the difference between .get() and .fetch(1)

I have written an app and part of it is uses a URL parser to get certain data in a ReST type manner. So if you put /foo/bar as the path it will find all the bar items and if you put /foo it will return all items below foo So my app has a query like data = Paths.all().filter('path =', self.request.path).get() Which works brilliantly. ...

google app engine - auto increment

Hi, I am new to Google App Engine, I have this entites User class - user_id - integer user_name - string password - string I want to do auto increment for the user_id,How I can do this? ...

Try to fill the GAE datastore but the code consumes to much cpu time. How to optimize this?

I try to get the list of images in Amazon EC2 inside the Google datastore. I want to realize this with a cron job inside the GAE. class AmazonEC2uswest(db.Model): ami = db.StringProperty(required=True) mani = db.StringProperty() typ = db.StringProperty() arch = db.StringProperty() state = db.StringProperty() owne...

What's faster Model.get(keys) or Model.get_by_id(ids, parent=None)

I'm wondering is there a difference in terms of computing cost for the Model.get(keys) and Model.get_by_id(ids, parent=None) methods? Is there a server side computing advantage of using numeric id's over encoded string keys, or other way around? How big is the difference? PS. Sorry if it's a dupe. I'm sure I read an article about it, b...

GQL example for server side admin console query with reference property filter.

How to construct a GQL query using server side admin datastore viewer, a one that filters on a reference property? SELECT * from Model where reference_property = <what goes here> ...

Filtering by entity key name in Google App Engine on Python

On Google App Engine to query the data store with Python, one can use GQL or Entity.all() and then filter it. So for example these are equivalent gql = "SELECT * FROM User WHERE age >= 18" db.GqlQuery(gql) and query = User.all() query.filter("age >=", 18) Now, it's also possible to query things by key name. I know that in GQL you d...

How to finish a broken data upload to the production Google App Engine server?

I was uploading the data to App Engine (not dev server) through loader class and remote api, and I hit the quota in the middle of a CSV file. Based on logs and progress sqllite db, how can I select remaining portion of data to be uploaded? Going through tens of records to determine which was and which was not transfered, is not appealin...

How long (max characters) can a datastore entity key_name be? Is it bad to haver very long key_names?

What is the maximum number of characters that can be used to define the key_name of a datastore entity? Is it bad to have very long key_names? For example: Lets say we use key_names of a 170 characters, which is the length of a Twitter message 140 plus 10 numeric characters for latitude and 10 for longtitude and 10 for a timestamp. ...

In datastore, confused on how to pass a list of key_names as an argument to somemodel.get_or_insert() ?

Are there examples of how to pass a list of key_names to Model.get_or_insert() ? My Problem: With a method of ParentLayer I want to make the children. The key_names of the new (or editable) entities of class Child will come from such a list below: namesList = ["picture1","picture2"] so I should be able to build a list of key_names...

How to search from many GAE datastore? Is it possible to use Search API?

I want to create search interface to search data from GAE datastore? Can i use Google Search API to search this way? ...

Is there some performance issue between leaving empty ListProperties or using dynamic (expando) properties?

Is there a datastore performance difference between adding dynamic properties of the expando class when they are needed for an entity or the simpler (for me) framework of just setting up all possible properties I might need from the start even though most instances will just be left empty. In my specific case I would be having 5-8 empty...

Need a cleaner way, which avoids too many 'if statements', to write this method for inputing data into datastore entity attributes?

What is the best way to reference datastore model attributes without using the four 'if statements' I have in the below sample code, which seem messy and inefficient. For real-world code I may have a situation of 100 attributes such as self.var1, self.var2, ... self.varN that I want to some how reference with just an integer (or strings)...

Any strategies for assessing the trade-off between CPU loss and memory gain from compression of data held in a datastore model's TextProperty?

Are very large TextProperties a burden? Should they be compressed? Say I have a information stored in 2 attributes of type TextProperty in my datastore entities. The strings are always the same length of 65,000 characters and have lots of repeating integers, a sample appearing as follows: entity.pixel_idx = 0,0,0,0,0,0,0,0,0,1,1,1,1,...

Using low level api for datastore in google app engine ? is it bad ?

There is little documentation on how to use the low level api for datastore and quite a lot on JPA and JDO and how it translates to it. My question is: is there any advantage in coding against the JPA or JDO specs instead of accessing directly the low level api for datastore ? From an initial look, it seems simple and straight forward...

GAE update different fields of the same entity

Hi, UserA and UserB are changing objectA.filedA objectA.filedB respectively and at the same time. Because they are not changing the same field one might think that there are no overlaps. Is that true? or the implementation of pm.makePersistnace() actually override the whole object... good to know... ...

appcfg.py upload_data entity kind problem

Hi, I am developing application on app-engine-path and I would like to upload some data to datastore. For example I have a model models/places.py: class Place(db.Model): name = db.StringProperty() longitude = db.FloatProperty() latitude = db.FloatProperty() If I save this in view, kind() of this entity is "models_place"...

Google App Engine - Dealing with concurrency issues of storing an object

My User object that I want to create and store in the datastore has an email, and a username. How do I make sure when creating my User object that another User object doesn't also have either the same email or the same username? If I just do a query to see if any other users have already used the username or the email, then there could...

Best option for Google App Engine Datastore and external database?

I need to get an App Engine app talking to and sharing data with an external database, The best option i can come up with is outputting the external database data to an xml file and then processing this in my app engine app and storing it inside the datastore, although the data being shared is sensitive data such as login details so ou...