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

Improve debug errors: CannotCoerceColumnException #2097

Open
benoitsdm opened this issue Nov 25, 2024 · 0 comments
Open

Improve debug errors: CannotCoerceColumnException #2097

benoitsdm opened this issue Nov 25, 2024 · 0 comments

Comments

@benoitsdm
Copy link

Documentation description

Thanks for the great library, super useful.

However it's not always easy to debug.
Something that was not very clear to me: i tried to change the type of a column, from text to int.

I got CannotCoerceColumnException Cannot coerce type in table my_table column my_col existing type bigint coerced type text value: None

I alter table to change the actual type in msqql but was thinking a None value caused an error.
But digging in the source code, this is just not supported:

            if is_complete_column(col_a) and is_complete_column(col_b):
                if not compare_complete_columns(tab_a_columns[col_b_name], col_b):
                    # attempt to update to incompatible columns
                    raise CannotCoerceColumnException(
                        schema_name,
                        table_name,
                        col_b_name,
                        col_b["data_type"],
                        tab_a_columns[col_b_name]["data_type"],
                        None,
                    )

Would be nice to give a more explicit error, there is no None value in my column

Are you a dlt user?

Yes, I run dlt in production.

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

No branches or pull requests

1 participant