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

Better Python error handling message when (header=true) is not passed during COPY FROM #2737

Closed
prrao87 opened this issue Jan 29, 2024 · 0 comments · Fixed by #2854
Closed
Assignees
Labels
usability Issues related to better usability experience, including bad error messages

Comments

@prrao87
Copy link
Member

prrao87 commented Jan 29, 2024

Consider a case where we're trying to insert LivesIn relations to an edge table:(:Person)-[:LivesIn]->(:City)

The data for the lives_in.csv is like this:

person_id,city_id
1,2
2,1

The following command is correct, and loads in the data when considering the header row.

COPY LivesIn FROM 'lives_in.csv' (header=true);

However, if the user forgets to specify the (header=true)clause, it will fail as expected, but the error message is not helpful:

Traceback (most recent call last):
  File "/code/kuzu-debug/load_data.py", line 59, in <module>
    conn.execute(load_lives_in_edges)
  File "/code/kuzu-debug/.venv/lib/python3.11/site-packages/kuzu/connection.py", line 80, in execute
    _query_result = self._connection.execute(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Conversion exception: Cast failed. person_id is not in INT64 range.

The above error message makes it seem like the data is incorrect, rather than something wrong with the way we specified it in the edge insertion query.

A better error message would be:

RuntimeError: Conversion exception: Cast failed. Expected INT64, got "person_id"

Stating it this way clearly states what the parser expects, and what it found, making user experience during debugging much better.

@prrao87 prrao87 added usability Issues related to better usability experience, including bad error messages frontend Frontend, i.e., binder, parser, query planning-related issues and removed frontend Frontend, i.e., binder, parser, query planning-related issues labels Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usability Issues related to better usability experience, including bad error messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants