การทดสอบ data pipeline ด้วยตนเอง

ETL และ ELT ด้วย Python

Jake Roach

Data Engineer

การทดสอบ data pipeline

ควรทดสอบ data pipeline อย่างละเอียดถี่ถ้วน

  • ตรวจสอบว่าข้อมูลถูกดึง แปลง และโหลดได้ถูกต้อง

$$

การตรวจสอบ pipeline ช่วยลดภาระการบำรุงรักษาหลัง deploy

  • ระบุและแก้ไขปัญหาคุณภาพข้อมูล
  • เพิ่มความน่าเชื่อถือของข้อมูล

เครื่องมือและวิธีการทดสอบ data pipeline

  • End-to-end testing
  • การตรวจสอบข้อมูลที่ "จุดตรวจ"
  • Unit testing
ETL และ ELT ด้วย Python

สภาพแวดล้อมทดสอบและ production

สภาพแวดล้อมทดสอบและ production สำหรับสร้างและรัน data pipeline

ETL และ ELT ด้วย Python

การทดสอบ pipeline แบบ end-to-end

การทำ end-to-end testing ของ data pipeline

End-to-end testing

  • ยืนยันว่า pipeline รันได้สำเร็จซ้ำหลายครั้ง
  • ตรวจสอบข้อมูลที่จุดตรวจของ pipeline
  • ทำ peer review และนำ feedback มาปรับปรุง
  • ตรวจสอบว่าผู้ใช้เข้าถึงข้อมูลได้และพึงพอใจกับผลลัพธ์
ETL และ ELT ด้วย Python

การตรวจสอบจุดตรวจของ pipeline

# Extract, transform, and load data as part of a pipeline
...

# Take a look at the data made available in a Postgres database
loaded_data = pd.read_sql("SELECT * FROM clean_stock_data", con=db_engine)
print(loaded_data.shape)
(6438, 4)
print(loaded_data.head())
         timestamps      volume      open     close                            
1997-05-15 13:30:00  1443120000  0.121875  0.097917
1997-05-16 13:30:00   294000000  0.098438  0.086458
1997-05-19 13:30:00   122136000  0.088021  0.085417
ETL และ ELT ด้วย Python

การตรวจสอบ DataFrame

# Extract, transform, and load data, as part of a pipeline
...

# Take a look at the data made available in a Postgres database
loaded_data = pd.read_sql("SELECT * FROM clean_stock_data", con=db_engine)

# Compare the two DataFrames.
print(clean_stock_data.equals(loaded_data))
True
ETL และ ELT ด้วย Python

มาฝึกกันเถอะ!

ETL และ ELT ด้วย Python

Preparing Video For Download...