checking-freshness

โดย astronomer

ตรวจสอบความสดใหม่ของข้อมูลโดยการตรวจสอบเวลาปรับปรุงของตารางและรูปแบบการอัปเดตเทียบกับระดับความเก่า ระบุคอลัมน์เวลาปรับปรุงโดยใช้รูปแบบการตั้งชื่อ ETL ทั่วไป (เช่น _loaded_at, _updated_at, created_at) และสอบถามค่าสูงสุดเพื่อกำหนดอายุ จัดประเภทข้อมูลเป็นสถานะความสดใหม่สี่สถานะ: สดใหม่ (น้อยกว่า 4 ชั่วโมง), เก่า (4–24 ชั่วโมง), เก่ามาก (มากกว่า 24 ชั่วโมง) หรือไม่ทราบ (ไม่พบเวลาปรับปรุง) มีเทมเพลต SQL สำหรับตรวจสอบเวลาปรับปรุงล่าสุดและแนวโน้มจำนวนแถวในช่วงไม่กี่วันที่ผ่านมาเพื่อ...

npx skills add https://github.com/astronomer/agents --skill checking-freshness

Data Freshness Check

Quickly determine if data is fresh enough to use.

Freshness Check Process

For each table to check:

1. Find the Timestamp Column

Look for columns that indicate when data was loaded or updated:

  • _loaded_at, _updated_at, _created_at (common ETL patterns)
  • updated_at, created_at, modified_at (application timestamps)
  • load_date, etl_timestamp, ingestion_time
  • date, event_date, transaction_date (business dates)

Query INFORMATION_SCHEMA.COLUMNS if you need to see column names.

2. Query Last Update Time

SELECT
    MAX(<timestamp_column>) as last_update,
    CURRENT_TIMESTAMP() as current_time,
    TIMESTAMPDIFF('hour', MAX(<timestamp_column>), CURRENT_TIMESTAMP()) as hours_ago,
    TIMESTAMPDIFF('minute', MAX(<timestamp_column>), CURRENT_TIMESTAMP()) as minutes_ago
FROM <table>

3. Check Row Counts by Time

For tables with regular updates, check recent activity:

SELECT
    DATE_TRUNC('day', <timestamp_column>) as day,
    COUNT(*) as row_count
FROM <table>
WHERE <timestamp_column> >= DATEADD('day', -7, CURRENT_DATE())
GROUP BY 1
ORDER BY 1 DESC

Freshness Status

Report status using this scale:

StatusAgeMeaning
Fresh< 4 hoursData is current
Stale4-24 hoursMay be outdated, check if expected
Very Stale> 24 hoursLikely a problem unless batch job
UnknownNo timestampCan't determine freshness

If Data is Stale

Check Airflow for the source pipeline:

  1. Find the DAG: Which DAG populates this table? Use af dags list and look for matching names.

  2. Check DAG status:

    • Is the DAG paused? Use af dags get <dag_id>
    • Did the last run fail? Use af dags stats
    • Is a run currently in progress?
  3. Diagnose if needed: If the DAG failed, use the debugging-dags skill to investigate.

On Astro

If you're running on Astro, you can also:

  • DAG history in the Astro UI: Check the deployment's DAG run history for a visual timeline of recent runs and their outcomes
  • Astro alerts for SLA monitoring: Configure alerts to get notified when DAGs miss their expected completion windows, catching staleness before users report it

On OSS Airflow

  • Airflow UI: Use the DAGs view and task logs to verify last successful runs and SLA misses

Output Format

Provide a clear, scannable report:

FRESHNESS REPORT
================

TABLE: database.schema.table_name
Last Update: 2024-01-15 14:32:00 UTC
Age: 2 hours 15 minutes
Status: Fresh

TABLE: database.schema.other_table
Last Update: 2024-01-14 03:00:00 UTC
Age: 37 hours
Status: Very Stale
Source DAG: daily_etl_pipeline (FAILED)
Action: Investigate with **debugging-dags** skill

Quick Checks

If user just wants a yes/no answer:

  • "Is X fresh?" -> Check and respond with status + one line
  • "Can I use X for my 9am meeting?" -> Check and give clear yes/no with context

Skills เพิ่มเติมจาก astronomer

airflow-state-store
astronomer
Persists task and asset state across retries and DAG runs using Airflow 3.3's AIP-103 key/value stores (`task_state_store`, `asset_state_store`) and the…
creating-openlineage-extractors
astronomer
ตัวแยกข้อมูล OpenLineage แบบกำหนดเองสำหรับโอเปอเรเตอร์ Airflow ที่ไม่รองรับและสถานการณ์สายเลือดที่ซับซ้อน สองแนวทาง: เพิ่มเมธอด OpenLineage ลงในโอเปอเรเตอร์ที่คุณเป็นเจ้าของโดยตรง (แนะนำ) หรือสร้างตัวแยกข้อมูลแบบกำหนดเองสำหรับโอเปอเรเตอร์ของบุคคลที่สามที่คุณไม่สามารถแก้ไขได้ ตัวแยกข้อมูลจะสกัดกั้นการทำงานของโอเปอเรเตอร์ที่สามจุด: ก่อนการดำเนินการสำหรับสายเลือดแบบคงที่ หลังจากสำเร็จสำหรับเอาต์พุตที่กำหนดในรันไทม์ และหลังจากล้มเหลวสำหรับสายเลือดบางส่วน ลงทะเบียนตัวแยกข้อมูลผ่าน airflow.cfg หรือสภาพแวดล้อม...
debugging-dags
astronomer
การวิเคราะห์สาเหตุที่แท้จริงอย่างเป็นระบบและการแก้ไขสำหรับ Airflow DAGs ที่ล้มเหลว พร้อมขั้นตอนการตรวจสอบที่มีโครงสร้าง ชี้แนะผ่านกระบวนการวินิจฉัยสี่ขั้นตอน: ระบุความล้มเหลว ดึงรายละเอียดข้อผิดพลาด รวบรวมข้อมูลบริบท และส่งมอบขั้นตอนการแก้ไขที่สามารถดำเนินการได้ จัดหมวดหมู่ความล้มเหลวออกเป็นสี่ประเภท (ข้อมูล โค้ด โครงสร้างพื้นฐาน การพึ่งพา) เพื่อมุ่งเน้นการตรวจสอบและแนะนำการแก้ไขที่เหมาะสม ให้คำสั่ง CLI ที่พร้อมใช้งานสำหรับการดึงข้อมูลบันทึก การเปรียบเทียบการรัน การล้างงาน และ DAG...
delegating-to-otto
astronomer
Drives Astronomer's Otto agent (`astro otto`) as a delegated sub-agent for Airflow, dbt, and data-engineering work. Use when the user explicitly asks to "use…
deploying-airflow
astronomer
ปรับใช้ Airflow DAGs และโปรเจกต์ ใช้เมื่อผู้ใช้ต้องการปรับใช้โค้ด, ส่ง DAGs, ตั้งค่า CI/CD, ปรับใช้สู่ระบบผลิต หรือสอบถามเกี่ยวกับกลยุทธ์การปรับใช้…
deploying-go-sdk-bundles
astronomer
สร้าง, แพ็ก, และปรับใช้ชุดรวม Airflow Go SDK ที่คอมไพล์แล้ว เพื่อให้ ExecutableCoordinator สามารถรันได้ ใช้เมื่อผู้ใช้ต้องการคอมไพล์ชุดรวมงาน Go, ถาม…
testing-dags
astronomer
วงจรการทดสอบ-ดีบัก-แก้ไขแบบวนซ้ำสำหรับ Airflow DAGs พร้อมการวินิจฉัยข้อผิดพลาดอย่างครอบคลุม เริ่มต้นด้วย af runs trigger-wait <dag_id> เพื่อรัน DAG และรอให้เสร็จสมบูรณ์ ไม่จำเป็นต้องตรวจสอบก่อนเริ่มต้น เมื่อเกิดข้อผิดพลาด ให้ใช้ af runs diagnose เพื่อสรุปข้อผิดพลาดอย่างครอบคลุม และ af tasks logs เพื่อตรวจสอบรายละเอียดข้อผิดพลาดจากงานเฉพาะ รองรับการกำหนดค่าเอง การหมดเวลา และการลองใหม่ จัดการสถานการณ์สำเร็จ ล้มเหลว และหมดเวลาพร้อมการตีความผลลัพธ์ที่ชัดเจน มีการตรวจสอบความถูกต้องอย่างรวดเร็ว...
tracing-downstream-lineage
astronomer
ติดตามสายข้อมูลปลายน้ำเพื่อประเมินผลกระทบจากการเปลี่ยนแปลงก่อนปรับแก้ตารางหรือ DAG ระบุผู้บริโภคโดยตรงของตารางเป้าหมายหรือ DAG ผ่านการค้นหาในซอร์สโค้ด การขึ้นต่อกันของวิว และการเชื่อมต่อเครื่องมือ BI สร้างแผนผังการขึ้นต่อกันแบบสมบูรณ์ที่แสดงผลกระทบปลายน้ำทั้งหมด ตั้งแต่ตารางไปจนถึงแดชบอร์ดและโมเดล ML จัดหมวดหมู่การขึ้นต่อกันตามความสำคัญ (วิกฤต สูง ปานกลาง ต่ำ) เพื่อจัดลำดับความสำคัญในการสื่อสารกับผู้มีส่วนได้ส่วนเสียและการทดสอบ สร้างรายงานผลกระทบพร้อมการประเมินความเสี่ยง ผลกระทบที่ได้รับ...