Skip to content

Application, made for generating spark SQL query. It takes JSON file, validates data based on CSV schema and returns ready to copy/paste sql query in newly created txt file or printed in console.

Notifications You must be signed in to change notification settings

Guiners/Spark-SQL-Converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Spark SQL Converter

Converter Json data to Spark SQL query based on DataBase schema you upload.

It works in two modes:

1. Output is printed in python console.
2. Output is saved to file in given path. 

Synopsis

python3 file.py --schema_file_path file1.csv --data_file_path file2.json [--query_file_path] file3.txt

Options

*schema_file_path*     string value with location of DataBase schema.

*data_file_path*       string value with location of Json file.
 
 query_file_path       string value with location where output query will be saved. INCLUDE name of file and extension.

** is required 

Usage

To get your output printed in console give only required arguments:

python3 spark-sql-converter.py --schema_file_path --data_file_path 

To get your output saved in file give also not required arguments:

python3 spark-sql-converter.py --schema_file_path --data_file_path --query_file_path

Examples

Print output in console:

python3 spark-sql-converter.py --schema_file_path "/Users/abc/Desktop/schema.csv" --data_file_path "/Users/abc/Desktop/data.json" 

Save output in txt file:

python3 spark-sql-converter.py --schema_file_path "/Users/abc/Desktop/schema.csv" --data_file_path "/Users/abc/Desktop/data.json" --query_file_path "/Users/abc/Desktop/sql_query"

About

Application, made for generating spark SQL query. It takes JSON file, validates data based on CSV schema and returns ready to copy/paste sql query in newly created txt file or printed in console.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published