Run data quality jobs from a PySpark notebook
In this tutorial, you learn how to run data quality jobs using a PySpark notebook environment, such as Databricks Notebook, Google Colab, and Jupyter.
Prerequisites
You are signed into Data Quality & Observability Classic (self-hosted).
You have permission to run jobs.
You have a PySpark notebook, such as Databricks Notebook, Google Colab, or Jupyter.
Steps
Step 1: Create a notebook
Select your PySpark notebook service of choice and create a new notebook.
Step 2: Install PySpark
To get started running a job from a PySpark notebook, open your new notebook and install PySpark.
Open your PySpark notebook.
Insert a new code cell into your notebook.
Add the following code:
Run the cell.
# Install
!pip install -q pyspark==3.4.1 # installs PySpark library version 3.4.1
!pip install -q findspark # installs the findspark libraryStep 3: Import the libraries
Insert a new code cell and add the following code:
Run the cell.
Step 4: Add the JAR files
In this step, make sure to add the correct JAR file to your notebook environment according to your Data Quality & Observability Classic (self-hosted) core JAR and Spark versions.
Step 5: Add secrets and environment details
Insert a new code cell and add the following code, replacing the sections between
""and''with your own information:
Run the cell.
Step 6: Start the SparkSession
Insert a new code cell and add the following code, replacing the sections between
""and''with your own SparkSession preferences:
Run the cell.
Step 7: Load the DataFrame
Insert a new code cell and add the following code, replacing the sections between
""and''with your own information:
Run the cell.
Step 8: Run the job
Insert a new code cell and add the following code:
Run the cell.
Step 9: Check the Jobs page in Data Quality & Observability Classic (self-hosted)
In another tab or window with Data Quality & Observability Classic (self-hosted) open, click the Jobs icon and check that your job was submitted to the Jobs queue for processing.
Last updated
Was this helpful?