[google-appengine] Re: Support for Decimal in Datastore?
Created issue in Google's tracker for this. Please star and promote. http://code.google.com/p/googleappengine/issues/detail?id=1063 On Jan 11, 11:35 am, eric.humphrey eric.humph...@gmail.com wrote: If you're adding a bunch of these up, it would be unneeded overhead. Those building apps that handle financial data or other numerics that require precision need thedecimaldata type. On Dec 5 2008, 7:25 am, Justin justin.drisc...@gmail.com wrote: Why not store the value as a string in the datastore and convert it to adecimalin Python on retrieval? You could use a property on your model to do it for you. importdecimal class MyModel(db.Model): string_amount = db.StringProperty(multiline=False) def get_amount(self): returndecimal.Decimal(self.string_amount) def set_amount(self, value): self.string_amount = str(value) amount = property(get_amount, set_amount) - Justin On Dec 5, 3:11 am, Fred Janon fja...@gmail.com wrote: Float andDecimalare two different types. Float is used in scientific calculations,Decimalfor accounting/financial applications.Decimalexists in Python but doesn't seem to be implemented in the Datastore. Fred On Fri, Dec 5, 2008 at 14:58, lock lachlan.hu...@gmail.com wrote: There is the FloatProperty, pretty sure that's what your after. http://code.google.com/appengine/docs/datastore/typesandpropertyclass... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Support for Decimal in Datastore?
If you're adding a bunch of these up, it would be unneeded overhead. Those building apps that handle financial data or other numerics that require precision need the decimal data type. On Dec 5 2008, 7:25 am, Justin justin.drisc...@gmail.com wrote: Why not store the value as a string in the datastore and convert it to adecimalin Python on retrieval? You could use a property on your model to do it for you. importdecimal class MyModel(db.Model): string_amount = db.StringProperty(multiline=False) def get_amount(self): returndecimal.Decimal(self.string_amount) def set_amount(self, value): self.string_amount = str(value) amount = property(get_amount, set_amount) - Justin On Dec 5, 3:11 am, Fred Janon fja...@gmail.com wrote: Float andDecimalare two different types. Float is used in scientific calculations,Decimalfor accounting/financial applications.Decimalexists in Python but doesn't seem to be implemented in the Datastore. Fred On Fri, Dec 5, 2008 at 14:58, lock lachlan.hu...@gmail.com wrote: There is the FloatProperty, pretty sure that's what your after. http://code.google.com/appengine/docs/datastore/typesandpropertyclass... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Support for Decimal in Datastore?
Float and Decimal are two different types. Float is used in scientific calculations, Decimal for accounting/financial applications. Decimal exists in Python but doesn't seem to be implemented in the Datastore. Fred On Fri, Dec 5, 2008 at 14:58, lock [EMAIL PROTECTED] wrote: There is the FloatProperty, pretty sure that's what your after. http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#FloatProperty --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Support for Decimal in Datastore?
Why not store the value as a string in the datastore and convert it to a decimal in Python on retrieval? You could use a property on your model to do it for you. import decimal class MyModel(db.Model): string_amount = db.StringProperty(multiline=False) def get_amount(self): return decimal.Decimal(self.string_amount) def set_amount(self, value): self.string_amount = str(value) amount = property(get_amount, set_amount) - Justin On Dec 5, 3:11 am, Fred Janon [EMAIL PROTECTED] wrote: Float and Decimal are two different types. Float is used in scientific calculations, Decimal for accounting/financial applications. Decimal exists in Python but doesn't seem to be implemented in the Datastore. Fred On Fri, Dec 5, 2008 at 14:58, lock [EMAIL PROTECTED] wrote: There is the FloatProperty, pretty sure that's what your after. http://code.google.com/appengine/docs/datastore/typesandpropertyclass... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Support for Decimal in Datastore?
On Fri, Dec 5, 2008 at 1:07 PM, Fred Janon [EMAIL PROTECTED] wrote: The Datastore doesn't seem to have support for Decimal or did I miss something? Is there a way (besides the classic /100 *100) to get a Decimal stored in the Datastore or do I need to follow the Extending Model Properties instructions? There's db.IntegerProperty and db.FloatProperty. Anything fancier and you'll need to do it yourself. Dave. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---