Command Palette

Search for a command to run...

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

implement-partitioned-connector

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

Single step only: implement a partitioned connector that extends SupportsPartitionedStream (or SupportsPartition) alongside LakeflowConnect. Do NOT use for…

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

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

Implement a Partitioned Connector

Goal

Implement a Python connector for {{source_name}} that conforms to both the LakeflowConnect interface and the SupportsPartitionedStream mixin (or SupportsPartition for batch-only partitioning). The implementation should be based on the source API documentation in src/databricks/labs/community_connector/sources/{source_name}/{source_name}_api_doc.md.

CRITICAL REQUIREMENT: Read and follow the patterns in the existing implement-connector SKILL at .claude/skills/implement-connector/SKILL.md — most of its rules (schema, metadata, incremental offsets, API best practices, etc.) apply here as well. This SKILL only covers the additional requirements for partitioned connectors.

Reference Files

  • SupportsPartition / SupportsPartitionedStream interface: src/databricks/labs/community_connector/interface/supports_partition.py
  • LakeflowConnect interface: src/databricks/labs/community_connector/interface/lakeflow_connect.py

Choosing the Right Mixin

  • SupportsPartitionedStream — Use when the connector needs partitioned streaming reads. This also automatically enables partitioned batch reads (inherits from SupportsPartition). This is the most common choice.
  • SupportsPartition — Use when the connector only needs partitioned batch reads and streaming should remain on the single-driver SimpleDataSourceStreamReader path.

Class Declaration

The connector class must extend both LakeflowConnect and the chosen mixin:

from databricks.labs.community_connector.interface import (
    LakeflowConnect,
    SupportsPartitionedStream,
)

class MyLakeflowConnect(LakeflowConnect, SupportsPartitionedStream):
    ...

Methods to Implement

From LakeflowConnect (always required)

  • list_tables()
  • get_table_schema(table_name, table_options)
  • read_table_metadata(table_name, table_options)
  • read_table(table_name, start_offset, table_options) — still required; used by simpleStreamReader for tables where is_partitioned() returns False

From SupportsPartition (batch partitioning)

  • get_partitions(table_name, table_options) — Return a list of partition descriptor dicts. Each dict is JSON-serialised and passed to read_partition on a Spark executor. Keep descriptors small (e.g., {"page": 3} or {"start": 100, "end": 200}).
  • read_partition(table_name, partition, table_options) — Read records for one partition. This runs on executors and must be self-contained (re-create API clients, do not rely on driver-side state).

Additional from SupportsPartitionedStream (streaming partitioning)

  • latest_offset(table_name, table_options, start_offset=None) — Return the most recent offset available. Called by Spark every micro-batch. start_offset is the current committed offset ({} on the first call). Return a dict with primitive values (str, int, bool). Micro-batch sizing (rows per batch, time window, etc.) is the connector's responsibility — use table_options (e.g. window_days, max_records_per_batch) to control it. The engine always requests "all available" and does not pass an admission-control hint.
  • get_partitions(table_name, table_options, start_offset=None, end_offset=None) — Overrides the batch version with optional offset params. When start_offset and end_offset are both None, behave as batch (partition the entire table). When offsets are provided, partition only the given range. Return an empty list when start_offset == end_offset.
  • is_partitioned(table_name) (optional override) — Return False for tables that should fall back to simpleStreamReader. Default is True.

How Partitioned Streaming Works

Spark drives each micro-batch in three steps:

  1. latest_offset — Called periodically on the driver to discover new data. Must be a lightweight metadata-only call (e.g., query the source for a max timestamp or latest event ID). Do NOT read actual records here.
  2. get_partitions(start, end) — Called with two adjacent offsets from successive latest_offset calls. The first micro-batch has start={} (empty dict from initialOffset), meaning "beginning of time". Split the range (start, end] into partition descriptors.
  3. read_partition — Called on executors for each partition. Fetch and return the actual records.

Offset discovery and data reading are separate. Unlike SimpleDataSourceStreamReader where read() discovers and returns data together, here latest_offset discovers what exists (cheap) and read_partition reads it (expensive, parallelised). Reading records inside latest_offset would be catastrophic — it runs on the driver every interval and the records are discarded.

Typical pattern: Source APIs with time-range filters (since/until). latest_offset returns the current high-water mark timestamp. get_partitions splits the time range into windows. read_partition queries each

Полный SKILL.md на GitHub

Установить implement-partitioned-connector в Claude Code и Claude Desktop

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

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

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

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

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

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

FAQ

Что делает скилл implement-partitioned-connector?

Single step only: implement a partitioned connector that extends SupportsPartitionedStream (or SupportsPartition) alongside LakeflowConnect. Do NOT use for full connector creation — use the create-connector agent instead.

Как установить скилл implement-partitioned-connector?

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

Скилл implement-partitioned-connector запускает скрипты?

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

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

Сравнить implement-partitioned-connector с