MeltanoLabs / MeltanoLabs/Singer-Working-Group

Handling Decimal / Numeric Data - Singer.Decimal Standards

Open
#32 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
15
Forks
4
PR merge metrics
No merged PRs in 30d

Description

There has been some discussion around how to handle Floats, Decimal and Numeric data.

We were finding that decimal data was ending up as floats in target-snowflake from various database taps. The taps were opinionated using the MultipleOf etc, but the results were in the wrong data type and we were finding there was truncation / rounding. Part of the issue was to do with the Python Language not supporting large numeric data leading to truncation.

We have learned about the singer.decimal format which doesn't take an opinion on the output format, leaving the target to determine how to treat the string representation of the numeric data. The problem with this is you loose a lot of automation, like the automated creation of tables or addition of columns with the correct datatype.

The problem is there needs to be further information provided to allow the correct creation of datatypes by the target as part of the schema message i.e. information about the precision and scale if it is available at source.

We have elected to add some AdditionalProperties - providing the Scale and Precision to help with decimal data. See the slack message below.

https://app.slack.com/client/TFG99TU9K/search/search-eyJkIjoiZGVjaW1hbCUyMGRhdGEiLCJxIjoiVTAyQjMxUUJTVUIiLCJyIjoiZGVjaW1hbCUyMGRhdGEifQ==/thread/C013EKWA2Q1-1650990076.383639

While we have taken an opinionate view on how to implement this, it would be great if there was some standards around how to navigate the challenges of emitting numeric data without data loss. We would also be interested in views around our approach to dealing with this issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the issue's discussion of Singer.Decimal, Python numeric limitations, and the linked Slack thread. Compare the proposed precision and scale AdditionalProperties with the requirements for target table creation and lossless numeric handling. Done means the working group agrees on a documented standard or a clearly scoped next step.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.