Skip to main content

JSON to Relational data model through Pyspark using Databricks

Project description

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.1] - 2021-10-17

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyspark_json_model-0.0.2.tar.gz (5.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_json_model-0.0.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pyspark_json_model-0.0.2.tar.gz.

File metadata

  • Download URL: pyspark_json_model-0.0.2.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

Hashes for pyspark_json_model-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d8e208ed9ee09f4f3c2133a4128f3ba8d8998d8ae511f1f5ca857da5bc188a3b
MD5 6afdb0d1215ad532951f8da9393b0e66
BLAKE2b-256 92091cc2c60e1b21de49706c7e601251e37a4afd4a6d5e72cdf29ae81620a89c

See more details on using hashes here.

File details

Details for the file pyspark_json_model-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyspark_json_model-0.0.2-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

Hashes for pyspark_json_model-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9fad039c5b1b89f45b5af47f383bfda231b93e12600211662072d60a04771faf
MD5 6314e66880c26462daa1eb59a2180f91
BLAKE2b-256 9d4de20001d6d2a6051c97368d842f93425dcc1b700d5a497ba7c34ac7a57525

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