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

Update notebooks for JupyterLab 4 upgrade and new SQL cell #10

Closed

Conversation

TitoGrine
Copy link
Contributor

@TitoGrine TitoGrine commented Aug 19, 2023

The JupyterLab version for notebooks will be updated to version 4.0.4. In JupyterLab 4, the source code of a cell is saved as a single string (likely related to the CodeMirror upgrade). Before, it was an array of strings where each string represented a line of code. Although JupyterLab 4 is still able to read these old notebook files, it seems to append a newline at the end of each string in the array. As a result, every newline in the old notebook gets duplicated. As such, this MR updates the template notebooks to turn the source array of string into a single string.

Additionally, notebooks will now support SQL cells, which are cells specified to run SQL without the need to pre-pend the magic command (i.e. %%sql). To mark a cell as SQL, its metadata needs to contain language: "sql". In the case where a cell used to output the results to a variable, the metadata must also contain output_variable: "<variable>". The notebooks were therefore updated to:

  • remove the SQL magic;
  • update these cells' metadata accordingly;
  • re-word explanation text to mention SQL cell instead of the magic command.

I only updated the SQL cells of notebooks which are currently on the Portal template list.

Note: There will likely also be a further update to the Image Matching with SQL notebook, since boto3 is broken with the new JupyterLab4 upgrade due to an incompatibility with the new version of urllib. A solution for this has not been decided yet.

@TitoGrine
Copy link
Contributor Author

Closing this PR as it is no longer valid:

  • Notebooks should accepts both string and []string options for source, so there is no need to update it here;
  • We are not pushing SQL cell just yet, so the templates should continue to refer to %%sql for running SQL.

@TitoGrine TitoGrine closed this Sep 6, 2023
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.

1 participant