Closed koshak01 closed 7 years ago
Hey, thanks for your interest, @koshak01! numeric would be a great addition to the library, but it would need a more complete implementation. I'll have a shot at it when time permits. What are your thoughts about the type of the python val? Would it serialize any type, or just decimal.Decimal
?
Hey, thanks for your interest, @koshak01! numeric would be a great addition to the library, but it would need a more complete implementation. I'll have a shot at it when time permits. What are your thoughts about the type of the python val? Would it serialize any type, or just
decimal.Decimal
?
Hi @altaurog, I'm just started using pgcopy and faced with issue when insert int
values to postgres numeric
. Why you decided to serialize only decimal.Decimal
? I think it would be good if at least int
can be serialized to numeric. In my opinion, there is no any corner cases with int
, not sure about other types which can be converted casted to decimal.Decimal
, this is also discussable. What do you think about this?
Hey @filippzorin, I am glad you have taken interest in this project.
I think the primary motivation was a simple and natural mapping between types. It is true that int
can be serialized to numeric
, but int
can easily be converted first to decimal.Decimal
as well. We could add some magic in the library to do that automatically for convenience, but there would have to be a compelling motivation. An int
in python will normally be stored in the database as int
.
take from https://doxygen.postgresql.org/backend_2utils_2adt_2numeric_8c.html#a57a8f8ab552bae24926d252180956958