डेटा पाइपलाइन की मॉनिटरिंग

Python में ETL और ELT

Jake Roach

Data Engineer

डेटा पाइपलाइन की मॉनिटरिंग

डेटा पाइपलाइनों को डेटा में बदलाव और execution की विफलताओं के लिए मॉनिटर करना चाहिए

  • Missing data
  • डेटा टाइप बदलना
  • पैकेज deprecation या functionality बदलना

$$

डेटा पाइपलाइन के लिए लॉगिंग वर्कफ़्लो.

Python में ETL और ELT

डेटा पाइपलाइन performance की लॉगिंग

  • execution पर performance डॉक्यूमेंट करें
  • समाधान फेल होने पर एक शुरुआती बिंदु देता है
import logging
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)

# Create different types of logs
logging.debug(f"Variable has value {path}")
logging.info("Data has been transformed and will now be loaded.")
DEBUG: Variable has value raw_file.csv
INFO: Data has been transformed and will now be loaded.
Python में ETL और ELT

warnings और errors की लॉगिंग

import logging
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)

# Create different types of logs
logging.warning("Unexpected number of rows detected.")
logging.error("{ke} arose in execution.")
WARNING: Unexpected number of rows detected.
ERROR: KeyError arose in execution.
Python में ETL और ELT

try-except से exceptions संभालना

try:
    # Execute some code here
    ...

except:
    # Logging about failures that occured
    # Logic to execute upon exception
    ...

  • errors होने पर कोड चलाने का तरीका देता है
Python में ETL और ELT

try-except से specific exceptions संभालना

except क्लॉज़ में specific exception पास करें

try:
    # Try to filter by price_change
    clean_stock_data = transform(raw_stock_data)
    logging.info("Successfully filtered DataFrame by 'price_change'")

except KeyError as ke:
    # Handle the error, create new column, transform
    logging.warning(f"{ke}: Cannot filter DataFrame by 'price_change'")
    raw_stock_data["price_change"] = raw_stock_data["close"] - raw_stock_data["open"]
    clean_stock_data = transform(raw_stock_data)

Python में ETL और ELT

अभ्यास करते हैं!

Python में ETL और ELT

Preparing Video For Download...