Skip to main content

Sparkly PyPi Version Sparkly Build Status Documentation Status

Helpers & syntax sugar for PySpark. There are several features to make your life easier:

  • Definition of spark packages, external jars, UDFs and spark options within your code;

  • Simplified reader/writer api for Cassandra, Elastic, MySQL, Kafka;

  • Testing framework for spark applications.

More details could be found in the official documentation.

Installation

Sparkly itself is easy to install:

pip install sparkly

The tricky part is pyspark. There is no official distribution on PyPI. As a workaround we can suggest:

  1. Use env variable PYTHONPATH to point to your Spark installation, something like:

    export PYTHONPATH="/usr/local/spark/python/lib/pyspark.zip:/usr/local/spark/python/lib/py4j-0.10.4-src.zip"
  2. Use our setup.py file for pyspark. Just add this to your requirements.txt:

    -e git+https://github.com/Tubular/spark@branch-2.1.0#egg=pyspark&subdirectory=python

Here in Tubular, we published pyspark to our internal PyPi repository.

Getting Started

Here is a small code snippet to show how to easily read Cassandra table and write its content to ElasticSearch index:

from sparkly import SparklySession


class MySession(SparklySession):
    packages = [
        'datastax:spark-cassandra-connector:2.0.0-M2-s_2.11',
        'org.elasticsearch:elasticsearch-spark-20_2.11:6.5.4',
    ]


if __name__ == '__main__':
    spark = MySession()
    df = spark.read_ext.cassandra('localhost', 'my_keyspace', 'my_table')
    df.write_ext.elastic('localhost', 'my_index', 'my_type')

See the online documentation for more details.

Testing

To run tests you have to have docker and docker-compose installed on your system. If you are working on MacOS we highly recommend you to use docker-machine. As soon as the tools mentioned above have been installed, all you need is to run:

make test

Supported Spark Versions

At the moment we support:

sparkly 2.x | Spark 2.0.x and Spark 2.1.x

sparkly 1.x | Spark 1.6.x

Release files for sparkly 2.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sparkly 2.6.0
File Size Uploaded
sparkly-2.6.0.tar.gz 29.0 kB Details

Release files / sparkly-2.6.0.tar.gz

Download URL sparkly-2.6.0.tar.gz
Size 29.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f62dafd397f2fcb57d7e798613e30f0637daef712a9568403baa4e715cb93514
BLAKE2b-256 checksum
How to use checksums
194863a8bf1f8b61f0635e51f6347f0531eb607f7c5e39e1fc87bc84e39cffc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.5

Release history Release notifications | RSS feed

2.8.2

1 release file

2.8.1

1 release file

2.8.0

1 release file

2.7.1

1 release file

2.7.0

1 release file

This release

2.6.0 This release

1 release file

2.5.1

1 release file

2.5.0

1 release file

2.4.1

2 release files

2.4.0

1 release file

2.3.0

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.4

1 release file

2.0.2

1 release file

2.0.1

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page