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.13.0.tar.gz (4.2 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.13.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for cde_submit_migration-0.13.0.tar.gz
Algorithm Hash digest
SHA256 dabe48dfd040ef7fb92f01c23ab621a23063ed70e3d81100a772c1ffa9b4b963
MD5 ea4e5900ef8fbb1c0640508b7e7476c0
BLAKE2b-256 c38e35046e3ce50ee18bfcb852655a28b8aae1935ab428c5c270e6ab8a5dbd7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cde_submit_migration-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38df16b14c7f0765b16b8c5c7f6a1422b27ed6dcaaf5c052b7c5848bea3133b5
MD5 4f5bf518d1cbbfd6a15a7f071c2e63e9
BLAKE2b-256 0faa4c0bc31c1d482768db652ec403cbd9613dea1fe8e6804ecf733ad7cf9244

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