Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import values as number/decimal #255

Open
dluo-sig opened this issue Sep 9, 2024 · 1 comment
Open

Cannot import values as number/decimal #255

dluo-sig opened this issue Sep 9, 2024 · 1 comment

Comments

@dluo-sig
Copy link

dluo-sig commented Sep 9, 2024

I'm trying to figure out how to get my data in as a number/decimal, instead of a double. My data type in SQL server is decimal(38,20). Here is my output data type:

"val2":{"inclusion":"available","multipleOf":1e-20,"type":["null","number"]}

However, this seems to come out in snowflake as a double/float and loses the precision. I see that a potential fix for this is to specify singer_decimal on the tap. In that case, I see that the data type is the following:

"val2":{"inclusion":"available","format":"singer.decimal","type":["null","number","string"],"additionalProperties":{"scale_precision":"(38,20)"}}

The problem with this approach is that it ends up in snowflake as a varchar. For what it's worth, regardless of singer_decimal specification, the actual value that I see in the output file of the tap has the correct precision. It's just lost somewhere when pushing it to snowflake.

Not sure if it's related, but I also see this in the code defining the python type as a float:

class NUMBER(sct.NUMBER):
    """Snowflake NUMBER type."""

    def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
        super().__init__(*args, **kwargs)

    @property
    def python_type(self):
        return float
@edgarrmondragon
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants