Restore SQL from Apache Spark Catalyst LogicalPlan JSON
Project description
spark-logicalplan-sql-restorer
Restore SQL from Apache Spark Catalyst LogicalPlan JSON payloads.
Install
pip install spark-logicalplan-sql-restorer
Python API
from pathlib import Path
import json
from spark_logicalplan_sql_restorer import (
restore_sql,
restore_sql_from_json_file,
restore_sql_from_json_string,
)
json_str = Path("test_json/001_00_setup_schema_01.json").read_text(encoding="utf-8")
sql1 = restore_sql_from_json_string(json_str)
payload = json.loads(json_str)
sql2 = restore_sql(payload)
sql3 = restore_sql_from_json_file(Path("test_json/001_00_setup_schema_01.json"))
print(sql1, sql2, sql3)
CLI
Restore one file:
logicalplan-sql-restorer test_json/001_00_setup_schema_01.json
Restore directory:
logicalplan-sql-restorer test_json --output restored_sql
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 spark_logicalplan_sql_restorer-0.1.0.tar.gz.
File metadata
- Download URL: spark_logicalplan_sql_restorer-0.1.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4db7a17f9453d0f9495e5c2133fd8e2ae34a81facd7d456b443d92521d2f5a35
|
|
| MD5 |
a459255f93ce3dcec135262358f74117
|
|
| BLAKE2b-256 |
b9b222e6846a56b5fafdfb8900aab79b1d23d130fbe170f7a131495a95b5feb6
|
File details
Details for the file spark_logicalplan_sql_restorer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spark_logicalplan_sql_restorer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46ebc55bce0b36020d28daf84746495b54536b96b0d31e7c4513c3824054cec1
|
|
| MD5 |
fe243a0fc3632343965c9348b7fd61a2
|
|
| BLAKE2b-256 |
9839d79a8a74b2bf03328eedcf33fe688eb255bb7adf191b761ed3961f881ba4
|