<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Pass Databricks's Spark session to a user defined module in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/pass-databricks-s-spark-session-to-a-user-defined-module/m-p/49550#M28580</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I have a .py file (not a notebook) where I have the following class with the following constructor:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class DataQualityChecker:
    def __init__(self, spark_session: SparkSession, df: DataFrame, quality_config_filepath: str) -&amp;gt; None:
        self.__spark = spark_session
        self.__df = df
        self.__quality_config = self.__import_quality_config(quality_config_filepath)
        self.__error_constraints = None&lt;/LI-CODE&gt;&lt;P&gt;I'm trying to use this class in a notebook as follows:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from data_quality import DataQualityChecker

quality_checker = DataQualityChecker(spark, df, quality_config)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;However, I am receiving the following error in the code snippet above:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;TypeError: __init__() takes 3 positional arguments but 4 were given&lt;/LI-CODE&gt;&lt;P&gt;Does anyone have any idea what it could be? I suspect the problem is trying to pass the spark variable as a parameter to the class constructor, but I don't know how to solve it.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Oct 2023 20:50:19 GMT</pubDate>
    <dc:creator>viniaperes</dc:creator>
    <dc:date>2023-10-19T20:50:19Z</dc:date>
    <item>
      <title>Pass Databricks's Spark session to a user defined module</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-databricks-s-spark-session-to-a-user-defined-module/m-p/49550#M28580</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I have a .py file (not a notebook) where I have the following class with the following constructor:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class DataQualityChecker:
    def __init__(self, spark_session: SparkSession, df: DataFrame, quality_config_filepath: str) -&amp;gt; None:
        self.__spark = spark_session
        self.__df = df
        self.__quality_config = self.__import_quality_config(quality_config_filepath)
        self.__error_constraints = None&lt;/LI-CODE&gt;&lt;P&gt;I'm trying to use this class in a notebook as follows:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from data_quality import DataQualityChecker

quality_checker = DataQualityChecker(spark, df, quality_config)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;However, I am receiving the following error in the code snippet above:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;TypeError: __init__() takes 3 positional arguments but 4 were given&lt;/LI-CODE&gt;&lt;P&gt;Does anyone have any idea what it could be? I suspect the problem is trying to pass the spark variable as a parameter to the class constructor, but I don't know how to solve it.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 20:50:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-databricks-s-spark-session-to-a-user-defined-module/m-p/49550#M28580</guid>
      <dc:creator>viniaperes</dc:creator>
      <dc:date>2023-10-19T20:50:19Z</dc:date>
    </item>
  </channel>
</rss>

