1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Data Pipelines

Exercise

Handling exceptions when loading data

Sometimes, your data pipelines might throw an exception. These exceptions are a form of alerting, and they let a Data Engineer know when something unexpected happened. It's important to properly handle these exceptions. In this exercise, we'll practice just that!

To help get you started, pandas has been imported as pd, along with the logging module has been imported. The default log-level has been set to "debug".

Instructions

100 XP
  • Update the pipeline to include a try block, and attempt to read the data from the path "sales_data.parquet".
  • Catch a FileNotFoundError if the file is not able to be read into a pandas DataFrame.
  • Create an error-level log to document the failure.