JSON to Relational data model through Pyspark using Databricks
Project description
Easily Parse your JSON & convert to relational data model format. This is currenlty build to support on Databricks/Pyspark
Description
This package if for converting any json formatted data to relational data model in dataframe format for databricks
jsontools: tools to parse json & converts to relational data model format
Installation
Normal installation
pip install pyspark_json_model
Development installation
git clone https://github.com/rohitpawar95/pyspark_json_model.git
cd pyspark_json_model
pip install --editable .
Usage
from pyspark_json_model import *
json2model_obj = jsontools.JSONParserPyspark('filepath_of_json',
<identifier_for_json_document:str>,
<is_looking_for_normalized_dataframe:bool>)
normalized_json_model = json2model_obj.process(sc, spark, ['drop_columns',...])
display(normalized_json_model[key])
Note:
is_looking_for_normalized_dataframe --> if True : The returned normalized_json_model
will hold extra key for root_node+'_normalized' which will have normalized json
format (This will be same as json_normalize function of pandas)
is_looking_for_normalized_dataframe --> if False : The returned normalized_json_model
will just contain multiple keys which will hold independent tables of data model
normalized_json_model : This will be dictionary of data model key will be table name
and value will be dataframe corresponding to this key
Pass sparkContext (sc) & sparkSession (spark) to process JSON along with
['drop_columns'] : The parameter to process() function is optional if need to remove
any columns while making this dataframe specify column list here
Change log
[0.0.3] - 2021-10-17
Added
Changed
Updated process function to handle UTF-8 BOM json format
Removed
[0.0.2] - 2021-10-17
Added
Changed
Updated process function to handle Array & Dict data types
Removed
[0.0.1] - 2021-10-14
Added
JSONParserPyspark.array_identification()JSONParserPyspark.check_all_done()JSONParserPyspark.get_nested_field()JSONParserPyspark.explode_struct_field()JSONParserPyspark.explode_array_df()JSONParserPyspark.add_random_id()JSONParserPyspark.main()JSONParserPyspark.drop_columns()JSONParserPyspark.drop_all_duplicates()JSONParserPyspark.remove_df()JSONParserPyspark.check_relationship()JSONParserPyspark.join_multiple_df()JSONParserPyspark.normalized_json()JSONParserPyspark.process()
Changed
Removed
Project details
Release history Release notifications | RSS feed
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 pyspark_json_model-0.0.3.tar.gz.
File metadata
- Download URL: pyspark_json_model-0.0.3.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78144d57bf9c43f91dac628c857dcc42c53806cf8b12793c69eaf99e86e411cd
|
|
| MD5 |
347c1a78c7e5bd919940ee9d64f2cf6e
|
|
| BLAKE2b-256 |
d87a69fd065d83d786fed542414f7573e22890d141dc1c23b154d1df6a2dd42a
|
File details
Details for the file pyspark_json_model-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pyspark_json_model-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d1f436a6e36e39e760d12d0c96b9aef0455cfa317b081c076ab990f1c884eaa
|
|
| MD5 |
55f3591cbc940bf3d42ca05272a8e491
|
|
| BLAKE2b-256 |
acd209b94eb7c5bf597bd3305f132b0a3766196af8f993ef020c786e457422aa
|