0

Piggy backing below answer.
adding syntax highlighting to Jupyter notebook cell magic

Added below in my jupyter/custom/custom.js.

require(['notebook/js/codecell'], function(codecell) {
  codecell.CodeCell.options_default.highlight_modes['magic_text/x-mssql'] = {'reg':[/^%%sql/]} ;
  Jupyter.notebook.events.one('kernel_ready.Kernel', function(){
  Jupyter.notebook.get_cells().map(function(cell){
      if (cell.cell_type == 'code'){ cell.auto_highlight(); } }) ;
  });
}); 

This makes the SQL syntax highlight that is true, but I cannot execute the cell itself due to
"UsageError: Cell magic %%sql not found.".
enter image description here

Any idea how make it actuallly executable?

Chris
  • 951
  • 10
  • 26

1 Answers1

0

You have to call %load_ext sql before using the %%sql magic cell.

enter image description here

See ipython-sql reference

JulioY
  • 21
  • 4