Skip to main content

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


Download files

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

Source Distribution

spark_logicalplan_sql_restorer-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file spark_logicalplan_sql_restorer-0.1.0.tar.gz.

File metadata

File hashes

Hashes for spark_logicalplan_sql_restorer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4db7a17f9453d0f9495e5c2133fd8e2ae34a81facd7d456b443d92521d2f5a35
MD5 a459255f93ce3dcec135262358f74117
BLAKE2b-256 b9b222e6846a56b5fafdfb8900aab79b1d23d130fbe170f7a131495a95b5feb6

See more details on using hashes here.

File details

Details for the file spark_logicalplan_sql_restorer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spark_logicalplan_sql_restorer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46ebc55bce0b36020d28daf84746495b54536b96b0d31e7c4513c3824054cec1
MD5 fe243a0fc3632343965c9348b7fd61a2
BLAKE2b-256 9839d79a8a74b2bf03328eedcf33fe688eb255bb7adf191b761ed3961f881ba4

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