Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

validate-incremental-sync

БесплатноБез исполняемых скриптовНе проверен

Validate that a connector's CDC/incremental sync implementation correctly tracks offsets and filters records.

databrickslabsот databrickslabs★ 74 звезды на GitHub

Об этом скилле

Validate Incremental Sync Behavior

Goal

Manually validate that a connector's CDC/incremental or Append-Only sync implementation is correct by:

  1. Understanding how the offset structure works from the code
  2. Verifying the offset matches the cursor field of the last record
  3. Testing that passing an offset filters records correctly

Scope

This guide validates cursor-based incremental sync where:

  • Offset contains one or more cursor fields (timestamps, IDs)
  • Filtering can be tested by setting a midpoint cursor value

Supported:

  • Single cursor: {"updated_since": "2024-01-15T00:00:00Z"}
  • Multi-field with cursor: {"team_id": "...", "updated_since": "2024-01-15T00:00:00Z"}

Not supported:

  • Delta tokens (API-provided opaque URLs)
  • Opaque pagination tokens (non-cursor-based)

Prerequisites

  • Connector must have CDC tables (tables with ingestion_type: cdc or cdc_with_deletes)
  • Access to connector code and test configuration
  • Run the test suite first to get table metadata and ingestion types

Step 1: Understand the Offset Structure

1.1 Read the Connector Code

First, examine the connector's read_table method to understand:

# Look for patterns like:
def read_table(self, table_name: str, start_offset: dict, table_options: dict):
    # How is start_offset used?
    updated_since = start_offset.get("updated_since")  # <-- offset key
    
    # How is the next offset calculated?
    max_updated_at = self._find_max_updated_at(records)
    next_offset = {"updated_since": max_updated_at}  # <-- offset structure
    
    return iter(records), next_offset

1.2 Document the Offset Structure per table

Question Answer
What are the offset keys? e.g., updated_since, last_id, team_id
Which key is the cursor? e.g., updated_since (the one used for filtering)
Single or multi-field? e.g., single {"updated_since": "..."} vs multi {"team_id": "...", "updated_since": "..."}
How is cursor calculated? e.g., max of updated_at field from records

Step 2: Run the Test Suite First

Instead of manually reading tables, run the test suite which already provides:

  • Table metadata (including ingestion_type and cursor_field)
  • Sample records from each table
  • Offset information

2.1 Run the Test Suite

Use the project virtual environment (Python 3.10+ required):

python3.10 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
python -m pytest tests/unit/sources/{source_name}/test_{source_name}_lakeflow_connect.py -v -s

2.2 Extract Information from Test Output

The test suite output shows:

✅ test_read_table_metadata
  Details: {
    "passed_tables": [
      {"table": "ideas", "metadata_keys": ["primary_keys", "cursor_field", "ingestion_type"]},
      ...
    ]
  }

✅ test_read_table
  Details: {
    "passed_tables": [
      {"table": "ideas", "records_sampled": 3, "offset_keys": ["updated_since"], "sample_records": [...]},
      ...
    ]
  }

2.3 Identify CDC Tables for Validation

Only validate tables with ingestion_type: cdc or cdc_with_deletes.

Skip tables with:

  • ingestion_type: snapshot - Full refresh, no offset tracking
  • ingestion_type: append - Append-only, no cursor filtering

From the test output, note:

  • Which tables are CDC
  • Their cursor_field (e.g., updated_at)
  • The offset_keys from test_read_table (e.g., ["updated_since"])

2.4 Verify Offset Structure Matches Code

Compare the test output with what you found in Step 1:

From Test Suite From Code Analysis Match?
offset_keys: ["updated_since"] Offset key: updated_since ✅/❌
cursor_field: updated_at Used in _find_max_updated_at() ✅/❌

2.5 Validate from Test Suite Output

The test_suite output shows the offset returned for each table:

✅ test_read_table
  Details: {
    "passed_tables": [
      {
        "table": "ideas",
        "records_sampled": 3,
        "offset_keys": ["updated_since"],     <-- offset key(s) returned
        "sample_records": [...]
      }
    ]
  }

Check:

  1. offset_keys is non-empty → offset is being returned ✅
  2. For CDC tables, offset should be present

If the test_suite passes and shows offset_keys, proceed to Step 3 to verify filtering actually works.

Expected Result

Check Expected
Offset key matches code ✅ e.g., updated_since
Offset value equals max cursor from records ✅ e.g., 2024-01-15T10:30:00Z
Only CDC tables are validated ✅ Snapshot/Append skipped

⚠️ IMPORTANT: If no offset is returned, or passing the offset doesn't change results, there may be an issue with the connector's incremental sync implementation.


Step 3: Test Incremental Filtering

Verify that passing a midpoint cursor value filters records correctly.

3.1 Setup

from tests.un
Полный SKILL.md на GitHub

Установить validate-incremental-sync в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл validate-incremental-sync?

Validate that a connector's CDC/incremental sync implementation correctly tracks offsets and filters records.

Как установить скилл validate-incremental-sync?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл validate-incremental-sync запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить validate-incremental-sync с