I am transferring some code from Databricks notebook into Jupyter notebook locally.
The following code that works in the Databricks Notebook is not working locally.
res = sc.broadcast(spark.read.table(my_table))
Here is my local code:
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
res = sc.broadcast(spark.read.table(my_table))
With the error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-67-dface594b1d3> in <module>
----> 1 ccode_dict = sc.broadcast(spark.read.table(my_table))
AttributeError: 'SparkSession' object has no attribute 'broadcast'
Is there any alternative to sc.broadcast()?
I am using Databricks connect to run my code locally: https://docs.databricks.com/dev-tools/databricks-connect.html