I created an object as below :
class Pivot:
def __init__(self, pivot_name):
global sqlContext
self._df = sqlContext.table(pivot_name)
In Databricks, I packaged this code in a .egg, attached it to my cluster, then, from a notebook (where sqlContext
is defined directly), I tried:
import Pivot
Pivot("my_pivot")
and got error name 'sqlContext' is not defined
Is there a way my .egg package can see directly the object sqlContext
or I need absolutely to pass it as an argument ?