Skip to main content

Lightweight spark-based migration runner for executing SQL migrations on Spark catalog tables in Cloudera Data Engineering (CDE).

Project description

cde-submit-migration

Lightweight Spark-based migration runner for executing SQL migrations on Spark catalog tables in Cloudera Data Engineering (CDE).

This repository contains a small CLI and a Spark job that can apply SQL migration files (single .sql file or a zipped folder containing multiple .sql files) to a Spark catalog. It was created to make it easy to run migrations either locally (for testing) or by submitting the job through CDE's cde spark submit command.

Highlights

  • Run a single SQL migration file or a folder (zipped automatically) containing multiple ordered .sql files.
  • Local mode (uses a local path-based Iceberg catalog) for development and testing.
  • Integration with Cloudera Data Engineering (cde spark submit) for production runs.

Requirements

  • Python 3.11 or later
  • pyspark==3.5.1

Install

uv tool install cde-submit-migration
pip install cde-submit-migration

After installation you should have following console command available: - submit-cde-migration to perform migration on CDE environment, - submit-local-migration to perform migration in local environment (for testing purposes)

To upgrade package to the latest version use following commands:

uv tool upgrade cde-submit-migration 
pip install --upgrade cde-submit-migration

Usage

submit-cde-migration --path path/to/migrations --db target_database --profile my-cde-profile
submit-local-migration --path path/to/migrations --db target_database

Notes on arguments:

  • --path — path to a single .sql file or a folder containing .sql files. When passing a folder in non-local mode, the folder is copied and zipped before submission.
  • --db — target database name to use as the current catalog database. If the database does not exist, it will be created.
  • --profile — optional CDE configuration profile name used when calling cde spark submit.

Project structure

  • src/cde_submit_migration/main.py — CLI entrypoint that either runs locally or packages and submits to CDE.
  • src/cde_submit_migration/migration.py — Spark job that executes SQL migration(s).
  • pyproject.toml — project metadata and dependencies.

Troubleshooting

  • If cde spark submit is not in your PATH, the CDE mode will fail. Make sure the cde CLI is installed and configured in the environment you use to run submit-cde-migration.
  • If you see Spark/Java version incompatibilities when running locally, verify your local Spark/PySpark installation matches the expected runtime (the project pins pyspark==3.5.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

cde_submit_migration-0.14.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

cde_submit_migration-0.14.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file cde_submit_migration-0.14.0.tar.gz.

File metadata

File hashes

Hashes for cde_submit_migration-0.14.0.tar.gz
Algorithm Hash digest
SHA256 78957714c5a4a8bf5d87864a7023dfe5e000122a2178da652cc4de03dc9ade7a
MD5 2609d10e0fd87a811730badb5b922428
BLAKE2b-256 fad864be488cd8aabe6dbe7e75c3a10d02f7aeda8780ec24a14084dfe3cce8be

See more details on using hashes here.

File details

Details for the file cde_submit_migration-0.14.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cde_submit_migration-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76d99aa2acedb7f3ffe882dbc875ed2713aec509d418693d919495c7319d4ef2
MD5 13f79ff14c860082279d3b750a60b77d
BLAKE2b-256 84fb7e0fcb05d6fcbeda0cc0da24dd2d809bbc452c097831d69bc171c71ea805

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