2008年6月27日金曜日

Property Names

name Property は alias ということ。

from google.appengine.ext import db

class MyModel(db.Model):
obj_key = db.StringProperty(name="key11")
content = db.StringProperty()

r = db.GqlQuery("select * from MyModel")
for rr in r:
print rr.content , rr.obj_key, key11
---
test None test



Transactions

Docs > Datastore API > Transactions

from google.appengine.ext import db

class Accumulator(db.Model):
 counter = db.IntegerProperty()
 a = Accumulator()
 a.counter = 0
 a.put()

def increment_counter(key, amount):
 obj = db.get(key)
 obj.counter += amount
 obj.put()

q = db.GqlQuery("SELECT * FROM Accumulator")
acc = q.get()
db.run_in_transaction(increment_counter,acc.key(), 5)
r = db.GqlQuery("select * from Accumulator" )

for rr in r:
 print rr.counter
----
5

2008年6月26日木曜日

Too Many Versions (403) The application already has the maximum number of versions.

2008-06-26 23:13:09,546 ERROR appcfg.py:1128 An unexpected error occurred. Aborting.
Rolling back the update.
Error 403: --- begin server output ---

Too Many Versions (403)
The application already has the maximum number of versions.
--- end server output ---


http://groups.google.com/group/google-appengine/browse_thread/thread/5bafb18014ca366a
issue として登録されているが
http://code.google.com/p/googleappengine/issues/detail?id=212&q=too%20many%20version&colspec=ID%20Type%20Status%20Priority%20Stars%20Owner%20Summary

application-id を変更するのは危険なので、しばらく静観。

http://groups.google.com/group/google-appengine/browse_thread/thread/24870ee8ecdfa34d/116c890c63876919#116c890c63876919


Fixed, i have to manually delete all the other version by dashboard,
than it started to work again fine...



一時はこの application-id はあきらめなければ
ならないのかとも思いましたが。

 バージョン情報を削除して復活です。

2008年6月25日水曜日

ascending single-property indexes are not necessary


Uploading index definitions.
Error 400: --- begin server output ---
Creating a composite index failed: ascending single-property indexes are not necessary
--- end server output ---

2008年6月24日火曜日

no matching index found

SDK 環境では徐々にデータを追加していったためか、あまり発生しなかったエラー

Cloud には bulkupload したためか、no matching index found エラーが多発する。
index.yaml に指定の内容を追加して update して対応。

2008年6月23日月曜日

DeadlineExceededError

削除は手動で画面を Reload して繰り返し実行すればいいが

r = db.GqlQuery("select * from Stock limit 100")
for rr in r:
 rr.delete()
後方一致 ( like *key_word ) の場合、offset で移動させた。
r = db.GqlQuery("select * from Model limit 100 offset " +  str(offset) )
start = int(offset) + 100
self.response.out.write('<a href="/xxx?offset=%s">del</a>' % str(start) )
for rr in r:
 if rr.trackback_url.find('</td></tr>') <>-1:
 ・・・

プログラムで LOOP させて offset を自動処理しては DeadlineExceededError はさけられず、
意味がない。

このあたり how should I clean up inside the datastore?
http://groups.google.com/group/google-appengine/browse_thread/thread/da854121e242755a?hl=en
でも話題になっているので、そのうち trauncate table のようなコマンドは用意されるか。
制限事項が多く、少々うんざり気味。

でも、RDBMS でも Undo 領域を必要としない truncate table ができるまでは Oracle などよく delete では「Rollbackセグメントが足りません」といってデータを思うように削除させてくれず、仕方がないので条件指定して少しづつ削除したこともあった。
Rollback などできなくていいから、まとめて削除させて欲しいと思いつつ。

untrusted app XXX cannot access app helloworld's data

BadRequestError: untrusted app XXX cannot access app helloworld's data


Reference Property の値( =Key ) をbulkupload
・・・
('stock', datastore_types.Key),
・・・
しようとして発生。

仮に upload できたとしても、意味がないのでコメントアウト。

Unityでドアの開閉はAnimatorそれともiTween?

Mac Mini M2 の Unity で Sketchup のデータを復元したつづき。 以前、苦労して作成したドアの開閉が動作しないので修復する。 どうやって動かしていたのか、また忘れそうなので記録しておく。             Animator 左右のドア PlaneL,...