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

Serialize UUIDs or show a better error when panicking on object columns #16872

Closed
jacopofar opened this issue Jun 11, 2024 · 0 comments · Fixed by #16954
Closed

Serialize UUIDs or show a better error when panicking on object columns #16872

jacopofar opened this issue Jun 11, 2024 · 0 comments · Fixed by #16954
Assignees
Labels
A-panic Area: code that results in panic exceptions accepted Ready for implementation enhancement New feature or an improvement of an existing feature

Comments

@jacopofar
Copy link

Description

When reading UUIDs from a Postgres database using read_database they get converted to Python UUID objects which causes a panic on some operations. As mentioned in #7175 having a UUID type could solve the problem. In any case, I think having an error reporting which column caused the issue would make troubleshooting a lot easier.

for example:

df = pl.read_database(
        "SELECT '11111111-1111-1111-1111-111111111111'::UUID",
        sqlalchemy.create_engine(
            'postgresql+psycopg://localhost'
        ),
    )
df.write_parquet("error.parquet")

this code will cause an error:

pyo3_runtime.PanicException: called `Option::unwrap()` on a `None` value

when invoking write_parquet because the type of the UUID column is "object". Replacing ::UUID with ::TEXT in the query avoids it.

I wouldn't call this a bug, it's only hard to troubleshoot as the message doesn't make it clear what the problem is (for example seeing the column name would be useful).

@jacopofar jacopofar added the enhancement New feature or an improvement of an existing feature label Jun 11, 2024
@stinodego stinodego added the A-panic Area: code that results in panic exceptions label Jun 11, 2024
@c-peters c-peters added the accepted Ready for implementation label Jun 16, 2024
@github-project-automation github-project-automation bot moved this to Ready in Backlog Jun 16, 2024
@c-peters c-peters moved this from Ready to Done in Backlog Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-panic Area: code that results in panic exceptions accepted Ready for implementation enhancement New feature or an improvement of an existing feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants