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

Python में ETL और ELT

Jake Roach

Data Engineer

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

डेटा और एग्ज़िक्यूशन फेल्योर के बदलावों के लिए डेटा पाइपलाइन की मॉनिटरिंग होनी चाहिए

  • Missing data
  • Shifting data types
  • Package deprecation या functionality change

$$

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

Python में ETL और ELT

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

  • एग्ज़िक्यूशन पर परफॉर्मेंस डॉक्यूमेंट करें
  • सॉल्यूशन फेल होने पर एक शुरुआती बिंदु देता है
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

वार्निंग और एरर की लॉगिंग

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
    ...

  • एरर हों तो कोड चलाने का तरीका देता है
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...