Skip to main content

License: MIT Code style: black

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

Release files for pyspark-json-model 0.0.3

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

Source distribution (sdist)

Source distribution for pyspark-json-model 0.0.3
File Size Uploaded
pyspark_json_model-0.0.3.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyspark-json-model 0.0.3
File Interpreter ABI Platform
pyspark_json_model-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / pyspark_json_model-0.0.3.tar.gz

Download URL pyspark_json_model-0.0.3.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
78144d57bf9c43f91dac628c857dcc42c53806cf8b12793c69eaf99e86e411cd
BLAKE2b-256 checksum
How to use checksums
d87a69fd065d83d786fed542414f7573e22890d141dc1c23b154d1df6a2dd42a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / pyspark_json_model-0.0.3-py3-none-any.whl

Download URL pyspark_json_model-0.0.3-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d1f436a6e36e39e760d12d0c96b9aef0455cfa317b081c076ab990f1c884eaa
BLAKE2b-256 checksum
How to use checksums
acd209b94eb7c5bf597bd3305f132b0a3766196af8f993ef020c786e457422aa
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

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