spark-python-data-source
Skill by databricks
Builds custom Python data sources for Apache Spark 4.0+ to read from and write to external systems. It covers batch and streaming readers and writers, aimed at developers who need a Spark connector for a system without a native one.
Install spark-python-data-source
Built from the published package, never by AI.
git clone --depth 1 https://github.com/databricks/databricks-agent-skills /tmp/databricks-agent-skills && mkdir -p ~/.claude/skills && cp -r /tmp/databricks-agent-skills/experimental/spark-python-data-source ~/.claude/skills/spark-python-data-sourceRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install spark-python-data-source in Claude Code
git clone --depth 1 https://github.com/databricks/databricks-agent-skills /tmp/databricks-agent-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/databricks-agent-skills/experimental/spark-python-data-source ~/.gemini/antigravity-cli/skills/spark-python-data-sourceAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install spark-python-data-source in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill guides an AI assistant through building custom Python data sources with the PySpark DataSource API. Each source uses a flat structure: a DataSource entry class, a shared base class, and separate batch or stream reader and writer classes. The skill points to reference files for an annotated template, partitioning strategies, authentication fallback chains, type mapping, streaming offsets, retry logic, testing, and production hardening.
The source describes design rules specific to Spark, such as importing third-party libraries inside executor methods and keeping dependencies few. It is written for developers who want to connect Spark to a database, API, message queue, or custom protocol, including cases where the user only asks to read from or write to a system.
Written from the project's SKILL.md and checked against it.
What it can do
- Batch readers and writersImplement DataSourceReader and DataSourceWriter classes for batch jobs.
- Streaming readers and writersBuild DataSourceStreamReader and DataSourceStreamWriter with JSON-serializable offsets.
- Partitioning strategiesSplit reads with time-based, token-range, or ID-range partitioning.
- Authentication patternsSupport Unity Catalog, cloud default credentials, and explicit credentials with fallback.
- Type conversionMap types between Spark and the external system, including nulls, timestamps, and UUIDs.
- Error handlingAdd exponential backoff and circuit breakers for transient failures.
- Testing patternsWrite unit and integration tests with pytest fixtures and mocks.
What you need
- Apache Spark 4.0 or later
- Python
- Databricks CLI (>= v1.0.0)
- A packaging tool such as uv, poetry, or hatch
Try asking
- Create a Spark data source for reading from MongoDB with sharding support
- Build a streaming connector for RabbitMQ with at-least-once delivery
- Write a data source for a REST API with OAuth2 and pagination
Good to know
- Required packages must be installed on all executor nodes, not only the driver.
- Uses flat single-level inheritance because PySpark serializes reader and writer instances.
- The DataSource API is synchronous, so async code is only advised when the SDK is async-only.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: experimental/spark-python-data-source/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to spark-python-data-source
All alternatives →Guides an assistant through the Kaggle CLI, covering competitions, datasets, notebooks, models, benchmarks, authentication and quota. It is for people who use the kaggle command-line tool.
Generates Python code that uses BigQuery DataFrames (BigFrames) for data processing, analysis and machine learning on BigQuery. It is meant for Python data tasks, and the source says to use bigquery-basics for SQL-first workflows.
Discovers connected data sources and proposes loading options when a workspace lacks the data a question needs. Suited to users who want to connect database, warehouse or cloud sources from the chat.
Guides developers through enabling the Data Manager API, setting up Application Default Credentials, and installing its client libraries. Built for developers who are getting started with the API and need local environment and access setup.
Guides authoring and validating Apache Airflow DAGs for Managed Service for Apache Airflow (MSAA), formerly Cloud Composer. Built for developers who create or extend Airflow DAGs in these environments.
Extracts structured JSON data from over 40 websites, including Amazon, LinkedIn, Instagram, TikTok, Facebook and YouTube. Built on Bright Data's Web Data APIs, it returns product details, profiles, reviews, posts and comments from a URL.
Compare with kaggle-cli, bigquery-bigframes or data-loading
spark-python-data-source: common questions
Does this skill work with Spark 3.x?
The source says it builds data sources for Apache Spark 4.0 and later. It does not state support for earlier versions.
Why should third-party imports go inside read and write methods?
The read and write methods run on executor processes that do not share the driver's Python environment. Top-level imports from the driver are not available there.
Can this skill handle streaming sources?
Yes. The skill covers DataSourceStreamReader and DataSourceStreamWriter, with guidance on offset tracking and non-overlapping partition boundaries for exactly-once semantics.
How do I install spark-python-data-source?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is spark-python-data-source free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is spark-python-data-source safe to use?
It scores 73 of 100. Grades: maintenance A, licence F, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to spark-python-data-source?
Similar skills: kaggle-cli, bigquery-bigframes, data-loading, data-manager-api-setup.
