-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat(python): Add mermaid output to show_graph
#20607
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #20607 +/- ##
==========================================
+ Coverage 79.00% 79.03% +0.03%
==========================================
Files 1566 1557 -9
Lines 221034 220550 -484
Branches 2510 2514 +4
==========================================
- Hits 174623 174308 -315
+ Misses 45837 45667 -170
- Partials 574 575 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kjgoodrick: FYI, needs a small update (some triple-quotes where you currently have single-quotes with multiline strings, I think) due to the requirement to support py3.9.
I'll try it out once fixed, but looks like it could be a handy/straightforward addition 🤔
Is there any reason why this is not implemented in Rust? |
This should not be implemented in python. |
@alexander-beedie Thanks for pointing this out, I have updated the code such that it is now python 3.9 compatible. @eitsupi @ritchie46 Thank you both for the comments, I think it should be fairly straightforward to move the mermaid generation code to rust and update the |
This is a fix for #12075 adding mermaid output to polars. I have decided that it makes more sense to have mermaid output come from the
show_graph
method instead ofexplain
becauseexplain
appears to be for generating printable representations of the query plan wherasshow_graph
is for generating strings that can be fed to a visualization engine (currently just graphviz)In addition to being able to output mermaid strings this PR will output a mermaid diagram if the user is in a notebook and graphviz is not installed. I think at some point it may be a better user experience to always export mermaid instead of the SVG in notebooks, but for now I did not want to change the behavior.