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

[BUG] improve error reporting for multistatement sql #2916

Merged

Conversation

amitschang
Copy link
Contributor

Called it a bug because the error is confusing, this fixes error behavior of multistatement sql. Before:

daft.sql('''SELECT * FROM df; SELECT count(*) FROM df''', cat)

results in this error:

daft.exceptions.InvalidSQLException: Unsupported SQL: 'SELECT * FROM df'

but of course that SQL is supported! With this change, error becomes:

daft.exceptions.InvalidSQLException: Unsupported SQL: 'Only exactly one SQL statement allowed, found 2'

which I believe is at least currently correct, and any future support of multiple statements would have to touch this area of code anyway.

@github-actions github-actions bot added the bug Something isn't working label Sep 25, 2024
@universalmind303
Copy link
Collaborator

@amitschang it looks like there's some merge conflicts. Once these are resolved, this should be good to merge!

@amitschang
Copy link
Contributor Author

@universalmind303 thanks! I rebased on the latest origin/main - actually didn't encounter a conflict somehow

Copy link

codspeed-hq bot commented Sep 27, 2024

CodSpeed Performance Report

Merging #2916 will not alter performance

Comparing amitschang:sql-multistatement-error-fix (3b9a1ad) with main (ab6d98d)

Summary

✅ 17 untouched benchmarks

@universalmind303 universalmind303 merged commit 2935abd into Eventual-Inc:main Sep 27, 2024
36 checks passed
sagiahrac pushed a commit to sagiahrac/Daft that referenced this pull request Oct 7, 2024
Called it a bug because the error is confusing, this fixes error
behavior of multistatement sql. Before:

```py
daft.sql('''SELECT * FROM df; SELECT count(*) FROM df''', cat)
```

results in this error:
```py
daft.exceptions.InvalidSQLException: Unsupported SQL: 'SELECT * FROM df'
```

but of course that SQL is supported! With this change, error becomes:

```py
daft.exceptions.InvalidSQLException: Unsupported SQL: 'Only exactly one SQL statement allowed, found 2'
```

which I believe is at least currently correct, and any future support of
multiple statements would have to touch this area of code anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants