3 ms·
Jupyter would be even better if it supported the seamless combination of Python and SQL code cells. My notebook code typically involves a data prep stage with
by stevesimmons 6y ago
Jupyter would be even better if it supported the seamless combination of Python and SQL code cells.
My notebook code typically involves a data prep stage with querying a SQL database, then downloading into Python for more complex analysis, ML modelling, integration with external data sources, etc. So the notebook has a Python kernel with SQL usually as embedded """-quoted strings.
Does anyone have a solution to treating selected code cells as SQL - with SQL highlighting and tooltips - exposed as string variables to the Python code?
Sparkmagic [1] does part of this for Python/SQL/Spark interoperability, but as far as I recall, doesn't support SQL syntax highlighting.
[1] https://github.com/jupyter-incubator/sparkmagic https://github.com/jupyter-incubator/sparkmagic
- galacticdessert 6y agoAgree this would be awesome. I reckon you could obtain something similar with pandas with pd.read_sql("<query>"), but a dedicated SQL cell akin to markdown cells would make it much more pleasant
- 3l3ktr4 6y agothat's pretty amazing work! there have been some efforts in the past to do that: https://github.com/minrk/allthekernels https://github.com/minrk/allthekernels I think it'd be hard to do something like this, but not impossible. Just a lot of work.
- pletnes 6y agoThere’s a %%bash cell magic which turns one cell into a bash cell. What about a %%xeus cell to run a SELECT (or any sql)? Would that work?
- krmk 6y agoLike this: https://pypi.org/project/ipython-sql/ https://pypi.org/project/ipython-sql/ ?