Closed rolandwalker closed 2 years ago
CI is failing on Python 3.6 since it doesn't have dataclasses
. Looks like there is a backport.
Tagging @amjith for general opinions before I put any more time in.
This pull request introduces 2 alerts when merging 1a08bb41258183f46976d95e848c8288a124cb1f into 09ee2027cd8b513eff11d7da6f1908528e65f216 - view on LGTM.com
new alerts:
Looks like Python 3.6 has already been EOL'ed. I'm happy to drop support for 3.6 since it is breaking the dataclass dependency.
Merging #1075 (269e48e) into main (48bd4c9) will decrease coverage by
1.15%
. The diff coverage is23.72%
.
@@ Coverage Diff @@
## main #1075 +/- ##
==========================================
- Coverage 67.92% 66.77% -1.16%
==========================================
Files 26 26
Lines 2756 2811 +55
==========================================
+ Hits 1872 1877 +5
- Misses 884 934 +50
Impacted Files | Coverage Δ | |
---|---|---|
mycli/key_bindings.py | 35.13% <20.00%> (-8.87%) |
:arrow_down: |
mycli/main.py | 63.44% <25.00%> (-1.84%) |
:arrow_down: |
mycli/packages/completion_engine.py | 61.90% <50.00%> (-0.17%) |
:arrow_down: |
mycli/config.py | 62.23% <0.00%> (-1.07%) |
:arrow_down: |
mycli/sqlcompleter.py | 83.84% <0.00%> (-0.44%) |
:arrow_down: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
This pull request introduces 2 alerts when merging 269e48ebf6ea32b49b9f8ceed608dc75f2b52659 into 09ee2027cd8b513eff11d7da6f1908528e65f216 - view on LGTM.com
new alerts:
This pull request introduces 2 alerts when merging 54a0928e7aeae4d21b259d46b1bd7988eef21fe7 into 09ee2027cd8b513eff11d7da6f1908528e65f216 - view on LGTM.com
new alerts:
Nicely done! :1st_place_medal:
@tobymao Thank you for your help in reviewing this PR. Your library sqlglot looks very interesting! I like the duckdb examples :smile:
Description
Using https://github.com/tobymao/sqlglot, prettify the current statement, almost always on to multiple lines, or un-prettify the statement, collapsing onto a single line.
This is something I would use all the time! I knew how to take it this far. Some things I didn't know how to do:
~There's no documentation yet pending approval of this direction.~ Solved
If there is more than one statement in the buffer, we neither prettify nor unprettify but ~give a beep.~ give a transient message in the toolbar.
There is some attempt to find an appropriate cursor position in the reformatted buffer but of course that is difficult to do perfectly. One would need the cooperation of the parser.
This introduces a dependency on sqlglot, when we already have a dependency on sqlparse. But sqlglot is a more capable reader and is being more actively maintained. We should not be bothered by the dependency; we should look into shifting more functionality to sqlglot.
Edit: In order to bring in the sqlglot dependency, we need to drop support for Python 3.6, per discussion below. We should also add 3.10 to CI in a separate PR.
Demo
https://user-images.githubusercontent.com/727482/187200145-4b2d745a-dc38-469a-8323-276e820a268a.mov
Checklist
changelog.md
.AUTHORS
file (or it's already there).