Skip to content

Commit

Permalink
databricks finally supports IPython HTML rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
tomweber-sas committed Nov 2, 2023
1 parent 6776592 commit e910b8c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
20 changes: 20 additions & 0 deletions saspy/doc/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ display -
To support other Notebooks display methods, different display interface have to be added to saspy.
If you want to run saspy in Zeppelin, set this in your configuration definition: 'display' : 'zeppelin',

Databricks: At some point since trying to support Databricks, they finally added support for IPython, which
is how Jupyter renders HTML. Now the default (Jupyter) display value works as is on Databricks. In V5.4.4,
I've changed the code path for display='databricks' to just use the default Jupyter path and that finally
works on that platform. So, the following paragraph is now moot (leaving it here for context).

As of version 3.1.7, I added 'databricks', but it turns out their method for rendering html can only be
executed from a cell in their notebook; meaning you have to type it in and pass it the string of html for
it to render. I have an `open issue <https://community.databricks.com/s/question/0D58Y00008l8WMwSAM/
Expand Down Expand Up @@ -727,6 +732,11 @@ display -
To support other Notebooks display methods, different display interface have to be added to saspy.
If you want to run saspy in Zeppelin, set this in your configuration definition: 'display' : 'zeppelin',

Databricks: At some point since trying to support Databricks, they finally added support for IPython, which
is how Jupyter renders HTML. Now the default (Jupyter) display value works as is on Databricks. In V5.4.4,
I've changed the code path for display='databricks' to just use the default Jupyter path and that finally
works on that platform. So, the following paragraph is now moot (leaving it here for context).

As of version 3.1.7, I added 'databricks', but it turns out their method for rendering html can only be
executed from a cell in their notebook; meaning you have to type it in and pass it the string of html for
it to render. I have an `open issue <https://community.databricks.com/s/question/0D58Y00008l8WMwSAM/
Expand Down Expand Up @@ -850,6 +860,11 @@ display -
To support other Notebooks display methods, different display interface have to be added to saspy.
If you want to run saspy in Zeppelin, set this in your configuration definition: 'display' : 'zeppelin',

Databricks: At some point since trying to support Databricks, they finally added support for IPython, which
is how Jupyter renders HTML. Now the default (Jupyter) display value works as is on Databricks. In V5.4.4,
I've changed the code path for display='databricks' to just use the default Jupyter path and that finally
works on that platform. So, the following paragraph is now moot (leaving it here for context).

As of version 3.1.7, I added 'databricks', but it turns out their method for rendering html can only be
executed from a cell in their notebook; meaning you have to type it in and pass it the string of html for
it to render. I have an `open issue <https://community.databricks.com/s/question/0D58Y00008l8WMwSAM/
Expand Down Expand Up @@ -1086,6 +1101,11 @@ display -
To support other Notebooks display methods, different display interface have to be added to saspy.
If you want to run saspy in Zeppelin, set this in your configuration definition: 'display' : 'zeppelin',

Databricks: At some point since trying to support Databricks, they finally added support for IPython, which
is how Jupyter renders HTML. Now the default (Jupyter) display value works as is on Databricks. In V5.4.4,
I've changed the code path for display='databricks' to just use the default Jupyter path and that finally
works on that platform. So, the following paragraph is now moot (leaving it here for context).

As of version 3.1.7, I added 'databricks', but it turns out their method for rendering html can only be
executed from a cell in their notebook; meaning you have to type it in and pass it the string of html for
it to render. I have an `open issue <https://community.databricks.com/s/question/0D58Y00008l8WMwSAM/
Expand Down
14 changes: 8 additions & 6 deletions saspy/sasbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@
_cfgfile_cnt = 0

try:
from IPython.display import HTML
from IPython.display import display as DISPLAY
from IPython.display import HTML
except ImportError:
def DISPLAY(x): print(x)
def HTML(x): return "IPython didn't import. Can't render HTML"
def DISPLAY(x):
print(x)
def HTML(x):
return "IPython didn't import. Can't render HTML"

def zepDISPLAY(x):
print(x)
Expand Down Expand Up @@ -219,9 +221,9 @@ def __init__(self, **kwargs):
if self.display.lower() == 'zeppelin':
self.DISPLAY = zepDISPLAY
self.HTML = zepHTML
elif self.display.lower() == 'databricks':
self.DISPLAY = dbDISPLAY
self.HTML = dbHTML
#elif self.display.lower() == 'databricks':
# self.DISPLAY = dbDISPLAY
# self.HTML = dbHTML
else:
self.DISPLAY = DISPLAY
self.HTML = HTML
Expand Down

0 comments on commit e910b8c

Please sign in to comment.