eren
This library contains Hive helper methods for PySpark users.
This README is a good way to learn about the Hive metastore for PySpark, even if you're not going to use this library directly.
Hive metastore background
The Hive metastore contains information on tables, where the data is located, and the schema of the data.
Registering tables in the Hive metastore is a great way to make nice Spark workflows for an organization. You can setup your Spark cluster to automatically regsiter all your organization's tables, so users can spin up clusters and immediately start querying the data with SQL syntax.
Suppose you have a table called important_customers and a database analyst that would like to query this table to generate a report for the accounting department on a weekly basis. If the important_customers table is registered in the Hive metastore, then the analyst can spin up a Spark cluster and run their queries, without having to worry about where the underlying data is stored or the schema.
How this library helps
This library contains helper methods to make it easier to manage your Hive metastore. You can use this libray to easily determine if a Hive table is managed, unmanaged, or non-registered for example.
You can also use this library to register Hive tables that are not currently in the metastore.
This library makes common Hive tasks for PySpark programmers easy.
Hive managed vs unmanaged vs non-registered tables
Hive managed tables are registered in the Hive metastore and have paths that are managed by Hive. Here's an example of how to create a managed table.
This table stores data in XX.
Hive Parquet vs Delta Lake tables
Working with Hadoop File System from Python
Eren also provides a top level interface for working with any implementation of HadoopFileSystem (ibcluding S3, HDFS/DBFS and Local File System).
from eren import fs
# spark: SparkSession
hdfs = fs.HadoopFileSystem(spark, "hdfs:///data") # returns an instance for access to HDFS
s3fs = fs.HadoopFileSystem(spark, "s3a:///bucket/prefix") # returns an instance for access to S3
local_fs = fs.HadoopFileSystem(spark, "file:///home/my-home") # return an instance for access to LocalFS
Glob Files
You can list files and directories on remote file system:
list_of_files = hdfs.glob("hdfs:///raw/table/**/*.csv") # list all CSV files recursively inside a folder on HDFS
Read/Write UTF-8 strings
You can read and write UTF-8 strings from/to remote file system. But be carefully! This method is extremely slow compared to regular spark.read. Do not use this for reading/writing data!
import json
hdfs.write_utf8("hdfs:///data/results/results.json", json.dumps({"key1": 1, "key2": 3}), mode="w")
json.loads(hdfs.read_utf8("hdfs:///data/results/results.json"))
Community
Blogs
Metadata
Release files for eren 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eren-0.0.1.tar.gz | 4.0 kB | Without provenance | Details for eren-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eren-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for eren-0.0.1-py3-none-any.whl |
Total release size: 8.4 kB
Release files / eren-0.0.1.tar.gz
| Download URL | eren-0.0.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d527f13d3a64dea6390b8bbada61ab42cbb9d4bbf1f90ebd6b84435f9f6f037a
|
|
BLAKE2b-256 checksum How to use checksums |
a37d236d210543e4b9755b93fd296fe83d9c471932ac22b541790e8cdf413db6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.9.5 Darwin/20.3.0
|
Release files / eren-0.0.1-py3-none-any.whl
| Download URL | eren-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76bbde0d377e236c9bf9b55ef0ee3a8d5ee3752d9aa349c583cf6eed2bd16a84
|
|
BLAKE2b-256 checksum How to use checksums |
c260fb622acd68551b2df1d1add65a71af747ac970b329eaeb43a1f2a4b08646
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.9.5 Darwin/20.3.0
|
Security for eren 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.