作者asleepme (500年没换昵称了)
看板Python
标题Re: [问题] google datastore 几个疑问
时间Sun Sep 4 17:54:50 2011
※ 引述《CMJ0121 (请多指教!!)》之铭言:
: 在 GAE中的 datastore
: 储存的东西我假装叫做 entity
: 那这个东西可以放很多你想要给他的 property(像是姓名/图片/email等等)
: 现在你已经上传一个 entity A (name: John)
: 经过put之後就会在datastore中 insert一笔资料
: 其中会自动产生这个 Key 这个property
: 可以当作是资料库中的 primary key 他是唯一且可以辨识
: 如果你在put一样的 entity A (name: John)
: 那 GAE会当成是你要insert一笔新的资料
: 只是跟原本的长的一模一样
: 如果是要做 update 则需要在put时给予 key值
: 找寻key值的方式是用 gql的查询方式
: 可以利用已知的条件去找到满足的 entity 再得到他的key 值
: http://code.google.com/intl/zh-TW/appengine/docs/python/datastore/creatinggettinganddeletingdata.html
还是不太懂实作上习惯的作法是怎样
所以是put的时候用给他 key_name = user.user_id() 这样吗?
有点不懂 user.nickname(), user.email(), user.user_id() 使用时机
user.email()跟user.user_id()拿来做unique key好像都是可以的?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 111.184.10.86