Re: [問題] google datastore 幾個疑問

看板Python作者 (500年沒換暱稱了)時間14年前 (2011/09/04 17:54), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
※ 引述《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
文章代碼(AID): #1EOqhifl (Python)
文章代碼(AID): #1EOqhifl (Python)