Enables the user to organize transformations of data with PySpark as a regular Python package.
Project description
transformlib
Enables the user to organize transformations of data with PySpark as a regular Python package.
Sample package structure:
squares
├── setup.py
└── squares
├── __init__.py
├── pipelines.py
└── transforms
├── __init__.py
├── range.py
└── squares.py
Transform
A Transform is a many to many relationship between inputs and outputs using a function to specify the relationship transformation.
Sample transform:
# range.py
from transformlib import transform_df, Output
from pyspark.sql import SparkSession
@transform_df(Output('range.parquet'))
def range():
spark = SparkSession.builder.getOrCreate()
return spark.range(100)
The output of one transform can be the input to another transforms.
# squares.py
from transformlib import transform_df, Output, Input
from pyspark.sql import functions as F
@transform_df(
Output('squares.parquet'),
range_=Input('range.parquet'),
)
def squares(range_):
return (
range_
.withColumn(
'squares',
F.pow(F.col('id'), F.lit(2))
)
)
Pipelines
Sample pipeline:
# pipelines.py
from transformlib import Pipeline
from squares import transforms
pipeline = Pipeline.discover_transforms(transforms)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file transformlib-0.0.1.tar.gz.
File metadata
- Download URL: transformlib-0.0.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
261d69b2098dd80a521f3411c0604aa6ab6a8c48feb9387a0774d999dde52647
|
|
| MD5 |
71cb1c6b3a8246989fec5151dd21f292
|
|
| BLAKE2b-256 |
68afe1d1c90c99e2a8966cfa468e48e60714a81e7e59125e160070572af9b2d0
|
File details
Details for the file transformlib-0.0.1-py3-none-any.whl.
File metadata
- Download URL: transformlib-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89b8b50b8218c86b75d037650c17f46da742981277e1015f6f187661374e9d8b
|
|
| MD5 |
1b6e5b9e7d58ad40e14be33279f8f24a
|
|
| BLAKE2b-256 |
97068c53fd9e622607dd8da0e0dde1302ba0a265abf4aff99e209f94ecd7e5dc
|