Search code examples
databricksazure-databricksgreat-expectations

How to open index.html file in databricks or browser?


I am trying to open index.html file through databricks. Can someone please let me know how to deal with it? I am trying to use GX with databricks and currently, data bricks store this file here: dbfs:/great_expectations/uncommitted/data_docs/local_site/index.html I want to send index.html file to stakeholder

enter image description here


Solution

  • I suspect that you need to copy the whole folder as there should be images, etc. Simplest way to do that is to use Databricks CLI fs cp command to access DBFS and copy files to the local storage. Like this:

    databricks fs cp -r 'dbfs:/.....' local_name
    

    To open file directly in the notebook you can use something like this (note that dbfs:/ should be replaced with /dbfs/):

    with open("/dbfs/...", "r") as f:
      data = "".join([l for l in f])
    
    displayHTML(data)
    

    but this will break links to images. Alternatively you can follow this approach to display Data docs inside the notebook.