Skip to main content

Collection of Apache Spark Custom Data Formats

Project description

PySpark Data Source Formats

This project provides a collection of custom data source formats for Apache Spark 4.0+ and Databricks, leveraging the new V2 data source PySpark API.


Documentation Status Latest Python Release


Formats

Currently, the following formats are supported:

Format Read Write Description
http-csv Yes No Reads CSV files in parallel directly from a URL.
http-json Yes No Reads JSON Lines in parallel directly from a URL.
http-page Yes No Parses HTML page, extracts links, fetches headers.

📖 Full Documentation — detailed options, examples, and API reference.

Installation

# Install PySpark 4.0.0
pip install pyspark==4.0.0

# Install the package using pip
pip install pysparkformat

For Databricks, install within a Databricks notebook using:

%pip install pysparkformat

This has been tested with Databricks Runtime 15.4 LTS and later.

Quick Start

http-csv

from pyspark.sql import SparkSession
from pysparkformat.http.csv import HTTPCSVDataSource

spark = SparkSession.builder.appName("example").getOrCreate()
spark.dataSource.register(HTTPCSVDataSource)

url = "https://example.com/data.csv"
df = spark.read.format("http-csv").option("header", True).load(url)
df.show()

http-json

from pysparkformat.http.json import HTTPJSONDataSource

spark.dataSource.register(HTTPJSONDataSource)

url = "https://example.com/data.jsonl"
df = spark.read.format("http-json").schema("name string, value int").load(url)
df.show()

http-page

from pysparkformat.http.page import HTTPPageDataSource

spark.dataSource.register(HTTPPageDataSource)

# Parse page for all links and get headers via HEAD requests
df = spark.read.format("http-page").load("https://example.com/")
df.show()  # columns: page_request_url, page_request_datetime, page_request_error, page_response_http_status, page_response_headers, page_backlink_url

Contribute

Contributions are welcome! We encourage the addition of new custom data source formats and improvements to existing ones.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysparkformat-0.0.13.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysparkformat-0.0.13-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file pysparkformat-0.0.13.tar.gz.

File metadata

  • Download URL: pysparkformat-0.0.13.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysparkformat-0.0.13.tar.gz
Algorithm Hash digest
SHA256 8b1d2c8ec0a01b3f74dd64604705d3607a993bfafe09769968112aa57518282e
MD5 ec5085336ca993a3a81d9bbacc5e9abf
BLAKE2b-256 7a0e835f2ae58e9dc32019d133b0dba8d8acac53d1055af47210950020f3c784

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysparkformat-0.0.13.tar.gz:

Publisher: release.yaml on aig/pysparkformat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysparkformat-0.0.13-py3-none-any.whl.

File metadata

  • Download URL: pysparkformat-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysparkformat-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 9ba9870d661418373dec95851ee917d328f9ac5e103cabbb26f4f89a00c148d3
MD5 bb6a7931ebff3c5efc8c5d10f9e5efed
BLAKE2b-256 10f8071b627510ee64fe13a6d6c811bef8f53b483bb438f61ab235300453d374

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysparkformat-0.0.13-py3-none-any.whl:

Publisher: release.yaml on aig/pysparkformat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page