You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
String support for Decimal and Numeric values #163
Decimal and Numeric types can also expand beyond this range. It would be nice to (optionally) allow sending and receiving numeric data as Strings for Decimal and Numeric types.
For a project I'm working on the id column of the table is a Decimal, so this would be useful.
Sorry this has gone unresponded to for so long. I definitely think it's a good feature request, but have no ETA on implementation. If it's important for your project, you should consider fixing it yourself and submitting a pull request. Otherwise, I'll leave this open and someone will get to it eventually.
I currently have a solution that just returns any number with > 53 bits of data as a String but not sure this is the most elegant solution. I'm more than willing to implemented the elegant solution, would just like some advisement on the best way to do so.
A question about implementation, we know that BIGINTs can be >53 bits of data but is there a max number of bits or is it like Python's long type? It could be that BIGINTS are returned as a LONG (an npm module for 64 bit integers) or another similar type.
I thought about this a bit in the context of #490
@cdmcnamara We don't want to return different data types depending on the value, that just makes it more difficult to code against.
@Nokel81 Using a npm module like bignum seems reasonable but it'll break all existing code. So it'll need to be config option, not turned on by default.
If this sounds like a good idea to enough folks, I can look into it coding this some time.
Hi there,
I guess ultimately it would be nice to be able to define custom encoders in tedious, ref. #678.
A workaround idea that worked for me: cast the Decimal column to Varchar in the SELECT statement, maybe even cast to Bigint.
Hi @ml-rex , will bring this PR up again. See if we can work with @arthurschreiber update and merge this if there is not other concern on this change. I think Arthur has a another idea under #678 for refactor data type handling that should also cover this is, but we have not got the band width to actually to work on it yet.
Activity
bretcope commentedon Jul 11, 2014
Sorry this has gone unresponded to for so long. I definitely think it's a good feature request, but have no ETA on implementation. If it's important for your project, you should consider fixing it yourself and submitting a pull request. Otherwise, I'll leave this open and someone will get to it eventually.
cdm6a commentedon Apr 21, 2016
I currently have a solution that just returns any number with > 53 bits of data as a String but not sure this is the most elegant solution. I'm more than willing to implemented the elegant solution, would just like some advisement on the best way to do so.
TheFarmer1 commentedon Oct 5, 2016
I would like to get a number back instead of a string.
Nokel81 commentedon Oct 11, 2016
A question about implementation, we know that BIGINTs can be >53 bits of data but is there a max number of bits or is it like Python's long type? It could be that BIGINTS are returned as a LONG (an npm module for 64 bit integers) or another similar type.
tvrprasad commentedon Feb 15, 2017
I thought about this a bit in the context of #490
@cdmcnamara We don't want to return different data types depending on the value, that just makes it more difficult to code against.
@Nokel81 Using a npm module like bignum seems reasonable but it'll break all existing code. So it'll need to be config option, not turned on by default.
If this sounds like a good idea to enough folks, I can look into it coding this some time.
@arthurschreiber for thoughts.
fennibay commentedon Mar 19, 2019
Hi there,
I guess ultimately it would be nice to be able to define custom encoders in tedious, ref. #678.
A workaround idea that worked for me: cast the Decimal column to Varchar in the SELECT statement, maybe even cast to Bigint.
KAMAELUA commentedon Mar 3, 2021
Is this thing is not available yet?
ml-rex commentedon Dec 15, 2023
Is this PR going to be merged?
#1493
Really need a feature to optionally return numeric value as string as we have long decimal numbers
MichaelSun90 commentedon Dec 15, 2023
Hi @ml-rex , will bring this PR up again. See if we can work with @arthurschreiber update and merge this if there is not other concern on this change. I think Arthur has a another idea under #678 for refactor data type handling that should also cover this is, but we have not got the band width to actually to work on it yet.