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

Fix: add ruamel serializer for decimal.Decimal values #3333

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

georgesittas
Copy link
Contributor

@georgesittas georgesittas commented Nov 5, 2024

This PR was motivated by the following issue (connection is BigQuery):

(.venv) ➜  playground cat models/*
-- models/child.sql
MODEL (
  name `project.george.child`,
  kind FULL
);

SELECT
  col
FROM `project.george.parent`

-- models/parent.sql
MODEL (
  name `project.george.parent`,
  kind FULL
);

SELECT
  CAST(299.99 AS NUMERIC(10, 2)) AS col

After running sqlmesh plan successfully against this simple project, the following command fails:

(.venv) ➜  playground sqlmesh create_test 'project.george.child' --query 'project.george.parent' 'select * from project.george.parent limit 1'
packages/ruamel/yaml/representer.py", line 347, in represent_undefined
    raise RepresenterError(f'cannot represent an object: {data!s}')
ruamel.yaml.representer.RepresenterError: cannot represent an object: 299.990000000

@georgesittas georgesittas requested a review from a team November 5, 2024 22:20
@georgesittas georgesittas force-pushed the jo/fix_ruamel_yaml_decimal_dumping branch from 1416db5 to 3c281eb Compare November 6, 2024 00:13
@georgesittas georgesittas merged commit dcfbc7d into main Nov 6, 2024
23 checks passed
@georgesittas georgesittas deleted the jo/fix_ruamel_yaml_decimal_dumping branch November 6, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants