Checking Freshness

作者 astronomercbe1141f547b无许可证451 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

Quick data freshness check. Use when the user asks if data is up to date, when a table was last updated, if data is stale, or needs to verify data currency before using it.

仅含说明Data & Analytics
AI 生成的概览

通过查询时间戳列检查数据库表的数据新鲜度,并报告过期状态。

功能
该技能指导智能体对数据库表进行数据新鲜度检查。它会定位时间戳列,运行 SQL 查询最后更新时间及近期行数,并将每张表分类为新鲜、过期、严重过期或未知。数据过期时还会建议检查 Airflow DAG 状态,并生成便于浏览的新鲜度报告。
适用场景
适用于用户询问数据是否最新、表上次更新时间,或数据是否过期的情况。也适合在使用数据前核实其时效性,包括为截止时间给出简明的“是/否”答复。
运行要求
需要访问被检查的数据库并能够运行 SQL 查询,包括 INFORMATION_SCHEMA。检查流水线状态需要 Airflow 访问权限和 af 命令行工具。该技能不附带脚本,仅为说明文档。

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

sql
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_agoFROM <table>

3. Check Row Counts by Time

For tables with regular updates, check recent activity:

sql
SELECT    DATE_TRUNC('day', <timestamp_column>) as day,    COUNT(*) as row_countFROM <table>WHERE <timestamp_column> >= DATEADD('day', -7, CURRENT_DATE())GROUP BY 1ORDER 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_nameLast Update: 2024-01-15 14:32:00 UTCAge: 2 hours 15 minutesStatus: Fresh
TABLE: database.schema.other_tableLast Update: 2024-01-14 03:00:00 UTCAge: 37 hoursStatus: Very StaleSource 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

来源与署名

来源:astronomer/agents位于skills/checking-freshness提交cbe1141

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架