Hi,
Here's the scenario:
I want to update the data on appengine by either modifying existing
model instances or adding new ones.
The uploaded data is in a format similar to this:
A00000011,<data fields>
A00000022,...
A00000033,...
so the first column is a unique id and the rest is more data. My idea
was to fetch all model instances with the given IDs, update those
which exist already and add the others.
Here's the query when the data is posted:
keys = []
for row in data:
keys.append(db.Key(row["first_column"]))
result = MyModel.get(keys)
the problem is appengine says to the db.Key(...) part that
File "c:\Program Files\Google\google_appengine\google\appengine\api
\datastore_
types.py", line 169, in __init__
raise datastore_errors.BadKeyError('Invalid string key %s.' %
encoded)
BadKeyError: Invalid string key A00000011.
It is true a model with this key does not exists yet in the db, but I
will set it as key_name when the model instance is created, since it
is unique, so why can't I use it for querying models?
How can I convert these unique keys into model keys for the query?
Can't I use a unique string as key for querying the db when that
string is not assigned to an existing model instance yet?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---