implement-partitioned-connector
БесплатноБез исполняемых скриптовНе проверенSingle step only: implement a partitioned connector that extends SupportsPartitionedStream (or SupportsPartition) alongside LakeflowConnect. Do NOT use for…
от 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 fromSupportsPartition). This is the most common choice.SupportsPartition— Use when the connector only needs partitioned batch reads and streaming should remain on the single-driverSimpleDataSourceStreamReaderpath.
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 bysimpleStreamReaderfor tables whereis_partitioned()returnsFalse
From SupportsPartition (batch partitioning)
get_partitions(table_name, table_options)— Return a list of partition descriptor dicts. Each dict is JSON-serialised and passed toread_partitionon 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_offsetis 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. Whenstart_offsetandend_offsetare bothNone, behave as batch (partition the entire table). When offsets are provided, partition only the given range. Return an empty list whenstart_offset == end_offset.is_partitioned(table_name)(optional override) — ReturnFalsefor tables that should fall back tosimpleStreamReader. Default isTrue.
How Partitioned Streaming Works
Spark drives each micro-batch in three steps:
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.get_partitions(start, end)— Called with two adjacent offsets from successivelatest_offsetcalls. The first micro-batch hasstart={}(empty dict frominitialOffset), meaning "beginning of time". Split the range(start, end]into partition descriptors.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
Установить 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), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic