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

display improvements #432

Merged
merged 25 commits into from
May 31, 2023
Merged

display improvements #432

merged 25 commits into from
May 31, 2023

Conversation

edublancas
Copy link

@edublancas edublancas commented Apr 22, 2023

This PR improves the messages displayed to the user

Describe your changes

  • [Doc] Hiding connection string when passing --alias when opening a connection (display improvements #432)
  • [Doc] Fix api/magic-sql.md since it incorrectly stated that listing functions was --list, but it's --connections (display improvements #432)
  • [Feature] Clearer message display when executing queries, listing connections and persisting data frames (display improvements #432)
  • Several missing tests added
  • Documenting Connection attributes
  • Added display module
  • Documents display module in developer documentation
  • Listing connections now displays an HTML table in Jupyter and a text-based one in the terminal

Issue number

Closes #X

Checklist before requesting a review


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

@idomic
Copy link

idomic commented Apr 22, 2023

I think this has to be on the side somewhere eventually, it's fine if we define the logic here and build the widget or CSS view later on.

@edublancas edublancas marked this pull request as ready for review May 28, 2023 16:15
Copy link

@yafimvo yafimvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. added minor notes.

doc/community/developer-guide.md Show resolved Hide resolved
src/sql/connection.py Show resolved Hide resolved
@edublancas edublancas requested a review from yafimvo May 29, 2023 16:23
Copy link

@idomic idomic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments, the connections table is a nice touch

src/sql/connection.py Show resolved Hide resolved
src/sql/display.py Outdated Show resolved Hide resolved
src/sql/magic.py Show resolved Hide resolved
src/tests/test_run.py Show resolved Hide resolved
@edublancas
Copy link
Author

@yafimvo, @idomic: addressed all the comments. please give it another pass.

one important thing:

while debugging my tests I realized we had some shared state (a new test would start with existing connections from previous tests), so I added a Connections.close_all() method and then ensured that the pytest fixtures would clean up connections.

This led to another problem: I found out a buggy test that started failing because it was inadvertently using a connection from another test. Since the test was checking legacy behavior, I removed the test

@edublancas edublancas requested a review from idomic May 30, 2023 18:36
Copy link

@idomic idomic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm added comments on the tests.
Please wait for Yafim's check on the custom connection before merging.

assert "***" in conn.url
assert conn.name == "user@db"
assert isinstance(conn.engine, Engine)
assert conn.dialect
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need those 2?
conn.dialect, conn.session

assert "<duckdb.DuckDBPyConnection" in txt
assert "sqlite:///my.db" in txt
assert "duckdb:///somedb" in txt
assert "sqlite://" in txt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing if sqlite:///my.db is in txt, sqlite: will definitely be there. so maybe parameterization is better here.

Copy link

@yafimvo yafimvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

Please wait for Yafim's check on the custom connection before merging.

Looks good!

image

@idomic idomic merged commit 98ca942 into master May 31, 2023
@idomic idomic deleted the display branch May 31, 2023 10:06
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.

3 participants