I am currently creating many tables in python and most of the cells need their own SQL query. I am ending up with a long list of SQL querys. Ideally I would put the table creation of each table in its own file and load the files from a main notebook.
Is there a way to run sub-notebooks (containing the tables) from one main notebook? Mathematica has the EvaulateNotebook[] function which does exactly this. For python I found the nbconvert package which seems to come close to what I need. However, nbconvert seems to run in its own kernel. I would need the sub-notebook to have access to all variables in the main-notebook and subesquently the main-notebook to have acess to the variables in the sub-notebook.
In the end I would like to have the convenience of the notebooks in terms of editing, while not having to scroll through each and every table if I only need to change one table. So I am a bit reluctant to build a standard python package which I import, but would rather have a way to run a sub-ipynb in a way as if the cells where in the main-notebook.
I don't believe this is currently possible in Jupyter to have "child" notebooks in the same way you can with knitr.
Fernando Perez wrote a script to merge together multiple notebooks which may be helpful in your case to avoid having to scroll through a lot of text.
It looks like this may also eventually be incorporated into the main nbconvert codebase (see issue here).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With