Datastore

  • スキーマレスなので、フィールドを増やすときは注意
    • 増えたフィールドは<missing>となり、クエリーにそのフィールドを含めると常に検索にヒットしない
    • モデルにバージョン番号をつけて、デフォルト値を書き込むバッチを走らせるのが定石らしい
    • djangoappengineの場合は、<missing>のフィールドを取得するとモデルで定義したデフォルト値になるらしい
      • なので、レコードを取得して保存し直せば一応対処可能

URL fetch

最大タイムアウトはリクエストハンドラで10秒、cron, taskqueueで10分
http://code.google.com/intl/en/appengine/docs/python/urlfetch/overview.html#Requests

それ以上を指定した場合は最大値でクリッピングされる
なので常に10分を指定してOK
http://groups.google.com/group/google-appengine/browse_thread/thread/95f7d9fae2a54e14

ローカルデバッグ

なぜか、localhostよりローカルIPで立てた方がレスポンスがいい
./manage.py runserver -a 192.168.0.10

管理Tips

Disable Datastore Writes

If you wish to make your datastore read-only, you can do so by clicking the Disable Writes button. This setting causes all attempts to write to your datastore to fail. Once you've disabled writes, any attempts to write to that datastore throw a capability disabled error. You can re-enable writes by clicking the Re-Enable Writes link.

データのエクスポート

$ ./appcfg.py download_data --config_file=bulkloader.yaml --url=http://darekonoko.appspot.com/_ah/remote_api --filename=person.csv --kind=djangoappengine_person
$ ./appcfg.py download_data --config_file=bulkloader.yaml --url=http://darekonoko.appspot.com/_ah/remote_api --filename=picture.csv --kind=djangoappengine_picture