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 error when calling sqlcmd #804

Merged
merged 10 commits into from
Aug 18, 2023
Merged

improve error when calling sqlcmd #804

merged 10 commits into from
Aug 18, 2023

Conversation

bbeat2782
Copy link

@bbeat2782 bbeat2782 commented Aug 16, 2023

Describe your changes

Improves error messages when running %sqlcmd commands

  1. Without a connection
    • Calling tables, columns, test, profile, explore from %sqlcmd raises RuntimeError: No active connection
    • Calling snippets from %sqlcmd displays No snippets stored message
  2. With sqlalchemy connection
    • Calling %sqlcmd commands works as expected
  3. With dbapi connection
    • Calling tables, columns, test, explore from %sqlcmd raises RuntimeError: %sqlcmd is only support with SQLAlchemy connections, not with DBAPI connections
    • Calling profile and snippets work as expected

demo.ipynb.zip

Issue number

Closes #761

Checklist before requesting a review


📚 Documentation preview 📚: https://jupysql--804.org.readthedocs.build/en/804/

@bbeat2782 bbeat2782 marked this pull request as ready for review August 16, 2023 17:23
@bbeat2782 bbeat2782 requested a review from edublancas as a code owner August 16, 2023 17:23
@bbeat2782
Copy link
Author

From the issue, %sqlcmd connect was mentioned, but I didn't include it in this PR because adding %sqlcmd connect has not been merged yet. Depending on which one get merged first, I will change the other one accordingly.

src/sql/magic_cmd.py Outdated Show resolved Hide resolved
src/sql/magic_cmd.py Outdated Show resolved Hide resolved
src/sql/magic_cmd.py Outdated Show resolved Hide resolved
src/tests/test_magic_cmd.py Show resolved Hide resolved
@bbeat2782 bbeat2782 requested a review from edublancas August 18, 2023 00:29
src/sql/magic_cmd.py Show resolved Hide resolved
src/sql/magic_cmd.py Outdated Show resolved Hide resolved
@bbeat2782 bbeat2782 requested a review from edublancas August 18, 2023 02:38
@edublancas edublancas merged commit 1142060 into ploomber:master Aug 18, 2023
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.

error when calling %sqlcmd snippets if there is no active connection
2 participants