我構建了一個appengine應用程序(python),該應用程序需要將整數值(100)中的現有數據存儲實體轉換爲貨幣轉換問題的浮點值(100.00)。 正確的做法如何?由於我的查詢返回錯誤,當我只是改變我的模型中的屬性類型。將IntegerProperty更改爲現有AppEngine DataStore的FloatProperty
舊型號:
class Learn(search.SearchableModel):
pid = db.ReferenceProperty(Product, collection_name='picks')
title = db.StringProperty()
description = db.TextProperty()
order = db.IntegerProperty()
cost = db.IntegerProperty(default=0)
cost1 = db.IntegerProperty(default=0)
新型號:
class Learn(search.SearchableModel):
pid = db.ReferenceProperty(Product, collection_name='picks')
title = db.StringProperty()
description = db.TextProperty()
order = db.IntegerProperty()
cost = db.FloatProperty(default=0.000)
cost1 = db.FloatProperty(default=0.000)
我需要一個適當的方法來改變這種數據存儲的屬性類型不改變(刪除舊的和添加新)現有數據。因爲它是許多其他表格/模型的關鍵。
感謝。
再次感謝尼克,考慮整數+美分的貨幣表。 – 2011-01-20 20:06:11