Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Fix for validation issue with decimal numbers #2

Merged
merged 1 commit into from Feb 25, 2020

Conversation

robmoore
Copy link

Applying fixes for validation error from koszti [https://github.com/koszti/target-postgres/tree/fix/multipleOf-validation-error].

For more detail, see Issues with floats in target-postgres.

Copy link

@micaelbergeron micaelbergeron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the context @robmoore, I have only 1 comment about this change and asked @koszti directly to provide context about it.

@@ -93,7 +105,8 @@ def persist_lines(config, lines):
raise Exception("Line is missing required key 'stream': {}".format(line))
stream = o['stream']
schemas[stream] = o
validators[stream] = Draft4Validator(o['schema'])
schema = float_to_decimal(o['schema'])
validators[stream] = Draft4Validator(schema, format_checker=FormatChecker())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@koszti why do we specifically need a FormatChecker now?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@micaelbergeron It doesn't look like it's actually necessary, since it concerns the format property and has nothing to do with decimals or multipleOf, but I don't think it hurts to keep it either.

Koszti may just have accidentally included two unrelated fixes at the same time when he submitted cubedevinc#11. This FormatChecker is still present in https://github.com/transferwise/pipelinewise-target-postgres/blob/master/target_postgres/__init__.py#L136, so we're probably OK keeping it here too.

I'm more than happy to submit a new PR that doesn't apply this change, though, if you prefer.

@DouweM
Copy link

DouweM commented Feb 24, 2020

@micaelbergeron We just ran into this ourselves in https://gitlab.com/meltano/meltano/issues/1783#note_293619781! Can you please merge this PR? :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants