Borrowing it
Nothing to install: this file belongs to alessandro9110/Speech-To-Text-With-Databricks. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/alessandro9110/Speech-To-Text-With-Databricks/main/.claude/skills/spark-python-data-source/SKILL.mdgit clone --depth 1 https://github.com/alessandro9110/Speech-To-Text-With-DatabricksWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/alessandro9110/speech-to-text-with-databricks/spark-python-data-source)<a href="https://agentmods.dev/skills/alessandro9110/speech-to-text-with-databricks/spark-python-data-source"><img src="https://agentmods.dev/badge/skills/alessandro9110/speech-to-text-with-databricks/spark-python-data-source/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/alessandro9110/speech-to-text-with-databricks/spark-python-data-source"><img src="https://agentmods.dev/badge/skills/alessandro9110/speech-to-text-with-databricks/spark-python-data-source.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00080 | $0.02354 |
| Opus 5.5 | $0.00032 | $0.00942 |
| Sonnet 5.5 | $0.00016 | $0.00471 |
| Haiku 4.5 | $0.00008 | $0.00235 |
Grade A, and why
spark-python-data-source scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
response = requests.get(f"{self.url}?start={partition.start}") How it starts
The opening of the file, as written. The whole thing — 312 lines — stays where its author put it; the contents beside it link to each section on GitHub.
spark-python-data-source
Build custom Python data sources for Apache Spark 4.0+ to read from and write to external systems in batch and streaming modes.
When to use
Use when building Spark connectors for external systems that lack native support:
- External databases, APIs, message queues
- Custom file formats or protocols
- Real-time streaming data sources
- Systems requiring specialized authentication or protocols
Triggers: "build Spark data source", "create Spark connector", "implement Spark reader/writer", "connect Spark to [system]", "streaming data source"
Instructions
You are an experienced Spark developer building custom Python data sources following the PySpark DataSource API. Follow these principles and patterns:
Core Architecture
Each data source follows a flat, single-level inheritance structure:
- DataSource class - Entry point returning readers/writers
- Base Reader/Writer classes - Shared logic for options and data processing
- Batch classes - Inherit from base +
DataSourceReader/DataSourceWriter - Stream classes - Inherit from base +
DataSourceStreamReader/DataSourceStreamWriter
Critical Design Principles
SIMPLE over CLEVER - These are non-negotiable:
✅ REQUIRED:
- Flat single-level inheritance only
- Direct implementations, no abstractions
- Explicit imports, explicit control flow
- Standard library first, minimal dependencies
- Simple classes with single responsibilities
❌ FORBIDDEN:
- Abstract base classes or complex inheritance
- Factory patterns or dependency injection
- Decorators for cross-cutting concerns
- Complex configuration classes
- Async/await (unless absolutely necessary)
- Connection pooling or caching (unless critical)
- Generic "framework" code
- Premature optimization
Implementation Pattern
from pyspark.sql.datasource import (
DataSource, DataSourceReader, DataSourceWriter,
DataSourceStreamReader, DataSourceStreamWriter
)
# 1. DataSource class
class YourDataSource(DataSource):
@classmethod
def name(cls):
return "your-format"
def __init__(self, options):
self.options = options
def schema(self):
return self._infer_or_return_schema()
def reader(self, schema):
return YourBatchReader(self.options, schema)
def streamReader(self, schema):
return YourStreamReader(self.options, schema)
def writer(self, schema, overwrite):
return YourBatchWriter(self.options, schema)
def streamWriter(self, schema, overwrite):
return YourStreamWriter(self.options, schema)
# 2. Base Writer with shared logic
class YourWriter:
def __init__(self, options, schema=None):
# Validate required options
self.url = options.get("url")
assert self.url, "url is required"
self.batch_size = int(options.get("batch_size", "50"))
self.schema = schema
def write(self, iterator):
# Import libraries here for partition execution
import requests
from pyspark import TaskContext
context = TaskContext.get()
partition_id = context.partitionId()
msgs = []
cnt = 0
for row in iterator:
cnt += 1
msgs.append(row.asDict())
if len(msgs) >= self.batch_size:
self._send_batch(msgs)
msgs = []
if msgs:
self._send_batch(msgs)
return SimpleCommitMessage(partition_id=partition_id, count=cnt)
def _send_batch(self, msgs):
# Implement send logic
pass
# 3. Batch Writer
class YourBatchWriter(YourWriter, DataSourceWriter):
pass
# 4. Stream Writer
class YourStreamWriter(YourWriter, DataSourceStreamWriter):
def commit(self, messages, batchId):
pass
def abort(self, messages, batchId):
pass
# 5. Base Reader with partitioning
class YourReader:
def __init__(self, options, schema):
self.url = options.get("url")
assert self.url, "url is required"
self.schema = schema
def partitions(self):
# Return list of partitions for parallel reading
return [YourPartition(0, start, end)]
def read(self, partition):
# Import here for executor execution
import requests
response = requests.get(f"{self.url}?start={partition.start}")
for item in response.json():
yield tuple(item.values())
# 6. Batch Reader
class YourBatchReader(YourReader, DataSourceReader):
pass
# 7. Stream Reader
class YourStreamReader(YourReader, DataSourceStreamReader):
def initialOffset(self):
return {"offset": "0"}
def latestOffset(self):
return {"offset": str(self._get_latest())}
def partitions(self, start, end):
return [YourPartition(0, start["offset"], end["offset"])]
def commit(self, end):
pass
What ships with it
7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 312 lines · 80 tokens per session scan A 2999b4fcc7e6
spark-python-data-source is a skill published in the GitHub repository alessandro9110/Speech-To-Text-With-Databricks (4 stars, last pushed 8mo ago), licensed MIT. It adds 80 tokens to every session and 2,354 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-02.
spark-python-data-source compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| spark-python-data-sourcealessandro9110/Speech-To-Text-With-Databricks | Skill | 4 | 8mo ago | MIT | A | 80 | Claude Code |
| databricks-expertpersonamanagmentlayer/pcl | Skill | 44 | 11d ago | Apache-2.0 | A | 74 | Claude Code |
| sqliPurpleAILAB/Decepticon | Skill | 6.5k | 8d ago | Apache-2.0 | A | 48 | Claude Code, Codex |
| sql-injectionPurpleAILAB/Decepticon | Skill | 6.5k | 8d ago | Apache-2.0 | A | 47 | Claude Code, Codex |
| bloodhound-queryPurpleAILAB/Decepticon | Skill | 6.5k | 8d ago | Apache-2.0 | A | 32 | Claude Code, Codex |
| nosqliPurpleAILAB/Decepticon | Skill | 6.5k | 8d ago | Apache-2.0 | A | 38 | Claude Code, Codex |
| omnigraphModernRelay/omnigraph | Skill | 1.9k | today | MIT | A | 96 | Claude Code, Codex |