GitHub
03/08/2025, 12:01 AMuse_singer_decimal. When this is set to true, it will send the data as a string but provides additional information about the scale and precision (if available) in the singer messages. When the target receives the message, if it has this additional singer decimal data, it can cast the data with the correct datatype. The good thing about this approach is that it is a setting, therefore based on your use case, you can emit numeric data in its native numeric format (default setting), or preferable enable the use_singer_decimal setting to gain more accurate numeric data.
We have found by using this methodology, there is no loss of precision. It would be great to introduce this ability into the SDK as it will ensure accurate numeric data being sent.
Examples of enhanced database taps which support this are:
• pipelinewise-tap-oracle
• pipelinewise-tap-mssql
• tap-sybase
• tap-db2
Example enhanced target with support for decoding singer-decimal data:
• pipelinewise-target-snowflake
More detail for tap-db2 written by @mjsqu .
DECIMALs from DB2 are given format property "singer.decimal" in the schema, with type property "number". The numeric scale & precision are stored as schema[additionalProperties][scale_precision], e.g. "additionalProperties":{"scale_precision":"(15,9)"}.
When the tap writes the RECORD message, "singer.decimal" informs the data value to be output into the message as a string
The snowflake target obtains the scale/precision from the schema message to create a column of type NUMBER(scale, precision).
meltano/sdkGitHub
03/08/2025, 12:01 AM