Re: [問題] google datastore 幾個疑問
※ 引述《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
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):
Python 近期熱門文章
PTT數位生活區 即時熱門文章