Skip to main content

Restore SQL from Spark Project logical plan JSON

Project description

spark-project-sql-restore

Standalone Python package that restores SQL text from Spark logical plan JSON containing org.apache.spark.sql.catalyst.plans.logical.Project.

Install

pip install spark-project-sql-restore

Usage

from spark_project_sql_restore import project_json_to_sql

plan_json = """
{
  "class": "org.apache.spark.sql.catalyst.plans.logical.Project",
  "projectList": [
    {
      "class": "org.apache.spark.sql.catalyst.expressions.Alias",
      "name": "a",
      "child": {
        "class": "org.apache.spark.sql.catalyst.expressions.Literal",
        "value": 1,
        "dataType": "integer"
      }
    }
  ],
  "child": {"class": "org.apache.spark.sql.catalyst.plans.logical.OneRowRelation"}
}
"""

sql = project_json_to_sql(plan_json)
print(sql)
# SELECT 1 AS a FROM (SELECT 1)

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_project_sql_restore-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

spark_project_sql_restore-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for spark_project_sql_restore-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d4425bd3f964f7c77f1246b7c7bbe364b5c4bb1ad215fc945cb4c62c608b669e
MD5 380d2a6ab682703402d4b596ccac1162
BLAKE2b-256 a72ac51caac69efcbf3ccdbc4209664c2a93a1bbb9b2b9d0b103c04e794ff74e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spark_project_sql_restore-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f103be85ba0a440fd0193212b4c0d835ca574e859b09e84935b6c64371f84a40
MD5 cb6996bdb73619880f07aa17be5e9e08
BLAKE2b-256 b7f46acfa9e675a47e0d2865977ea84433fa1e20b2699c83a092775ce9ba4e39

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