Skip to main content

Explore data files with pyspark

Project description

Spark File Explorer

When developing spark applications I came across the growing number of data files that I create.

CSVs are fine but what about JSON and complex PARQUET files?

To open and explore a file I used Excel to view CSV files, text editors with plugins to view JSON files, but there was nothing handy to view PARQUETs. Event formatted JSONs were not always readable. What about viewing schemas?

Each time I had to use spark and write simple apps which was not a problem itself but was tedious and boring.

Why not a database?

Well, for tabular data there problems is already solved - just use your preferred database. Quite often we can load text files or even parquets directly to the database.

So what's the big deal?

Hierarchical data sets

Unfortunately the files I often deal with have hierarchical structure. They cannot be simply visualized as tables or rather some fields contain tables of other structures. Each of these structures is a table itself but how to load and explore such embedded tables in a database?

For Spark files use... Spark!

Hold on - since I generate files using Apache Spark, why can't I use it to explore them? I can easily handle complex structures and file types using built-in features. So all I need is to build a use interface to display directories, files and their contents.

Why console?

I use Kubernetes in production environment, I develop Spark applications locally or in VM. In all environments I would like to have one tool to rule them all.

I like console tools a lot, they require some sort of simplicity. They can run locally or over SSH connection on the remote cluster. Sounds perfect. All I needed was a console UI library, so I wouldn't have to reinvent the wheel.

Textual

What a great project textual is!

Years ago I used curses but textual is so superior to what I used back then. It has so many features packed in a friendly form of simple to use components. Highly recommended.

Usage

Install package with pip:

pip install pyspark-explorer

Run:

pyspark-explorer

I recommend that you provide a base path. For local files that could be for example:

# Linux
pyspark-explorer file:///home/myuser/datafiles/base_path
# Windows
pyspark-explorer file:///c:/datafiles/base_path
# Remote hdfs cluster
pyspark-explorer hdfs://somecluster/datafiles/base_path

Default path is set to /, which represents local root filesystem and works fine even in Windows thanks to Spark logics.

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

pyspark_explorer-0.0.11.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

pyspark_explorer-0.0.11-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file pyspark_explorer-0.0.11.tar.gz.

File metadata

  • Download URL: pyspark_explorer-0.0.11.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.5

File hashes

Hashes for pyspark_explorer-0.0.11.tar.gz
Algorithm Hash digest
SHA256 1db35d97a5c7f9e7690624a7d958c248652f2b4893f974232f4a23dd7cc871d0
MD5 7586663f8b6a18c7a2b53203d55710c8
BLAKE2b-256 3168bd392af5baeeb1fef2002ecda4dcf72a048f98b14d35430ac13cdf6afb06

See more details on using hashes here.

File details

Details for the file pyspark_explorer-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for pyspark_explorer-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 83e43de499e57e4ba199603c2bfec66a2df6cdce0fae172014346dcfa013b4cc
MD5 0614c65ee7b78699ac003aaa1d0f9692
BLAKE2b-256 99f5a5475ed85d4e9d4bc4f3059b7e5368f81ec9e5484380a51bf137316cfb79

See more details on using hashes here.

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