spark-python-data-source

Build custom PySpark DataSources for batch and streaming external system connections.

1|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/leary-poken/ai-dev-kit --skill spark-python-data-source-leary-poken
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spark-python-data-source
Source: https://github.com/leary-poken/ai-dev-kit/tree/main/databricks-skills/spark-python-data-source
Command: npx skills add https://github.com/leary-poken/ai-dev-kit --skill spark-python-data-source-leary-poken

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Build and deploy custom PySpark DataSources to connect Spark with external systems (databases, APIs, queues, or custom protocols) in batch and streaming modes.

Core Features & Use Cases

  • Create a DataSource entry point plus base Reader/Writer classes, with concrete Batch and Stream implementations.
  • Support common data-integration tasks such as reading from REST APIs, writing to data sinks, and performing type conversion and partitioning.
  • Real-world use cases include building a MongoDB/MySQL data connector, streaming REST data into a lakehouse, or exporting Spark results to a messaging system.

Quick Start

Scaffold a PySpark DataSource project and start implementing your first DataSource.

Frequently Asked Questions about spark-python-data-source

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a custom PySpark DataSource to connect to an external API?

To create a custom PySpark DataSource, you implement a DataSource entry point, base readers and writers, and concrete Batch or Stream implementations. This connects Spark to external systems like APIs, databases, or queues for batch and streaming integration.

Can I use PySpark to stream data from a REST API into a lakehouse?

Yes, you can stream REST API data into a lakehouse by implementing a custom PySpark DataSource. The Skill provides concrete Stream implementations and guidance for partitioning and type conversion to support streaming data integration tasks.

What is the best way to structure a PySpark DataSource project for production?

The best way to structure a production PySpark DataSource is using a flat inheritance model with in-executor imports and minimal dependencies. This pattern ensures explicit error handling, security, and production-readiness across common data-integration scenarios.

Does building a custom Spark Python data source support both batch and streaming modes?

Yes, building a custom Spark Python data source supports both batch and streaming modes. You create concrete Batch and Stream implementations alongside base Reader and Writer classes to handle data integration across different processing paradigms.

How do I handle authentication and partitioning in a PySpark data connector?

You handle authentication and partitioning in a PySpark data connector by following explicit patterns provided within the concrete Batch and Stream implementations. The Skill offers specific guidance for these requirements to ensure secure and efficient data access.

Why should I use in-executor imports when building PySpark DataSources?

In-executor imports are recommended when building PySpark DataSources to maintain minimal dependencies and a flat inheritance model. This approach prevents dependency conflicts and ensures robust error handling across distributed Spark environments.