Sales pipeline processing for Databricks
Project description
๐ฏ Spark Pipeline Industrialization: A Packaged Python Project
๐งฑ Project Overview
This project focuses on industrializing the initial data processing workflow by transitioning from exploratory notebooks to a structured and packaged Python application.
Designed around a Medallion Architecture (Bronze -> Silver -> Gold), this pipeline aims to be fully reproducible, testable, and maintainable. It ensures a seamless flow from raw data ingestion to refined analytics, supporting automated execution and long-term versioning.
The Gold layer structures the data to answer specific business questions:
- Global Performance: Consolidated monthly revenue (normalized to a single currency).
- Store Performance: Comparative analysis of revenue across different boutiques.
- Best Sellers (Volume): Identification of most popular products by units sold.
- Best Sellers (Value): Identification of highest-grossing products.
๐๏ธ Project structure
sales_pipeline_TP/
โ
โโโ sales_pipeline/ # Code source du projet
โ โโโ config/
โ โ โโโ config.yaml # Configuration files
โ โโโ bronze/
โ โ โโโ ingestion.py # Data ingestion
โ โโโ silver/
โ โ โโโ cleaning.py # Data cleaning and filtering
โ โโโ gold/
โ โ โโโ aggregation.py # Data aggregation
โ โโโ utils/
โ โโโ spark_session.py # Spark session management
โ โโโ utils.py # Project constants & settings
โ โโโ Reset_Raw_Data.ipynb # Reinitializes project state
โโโ tests/
โ โโโ test_cleaning.py # Tests file
โ
โโโ main.py # Main pipeline
โโโ pyproject.toml # Project configuration
โโโ requirements.txt # Python dependencies
โโโ README.md # Project Documentation
๐ Usage
๐ฆ Install dependencies
Install all dependencies listed in requirements.txt:
pip install -r requirements.txt
โถ๏ธ Run the main program
To execute the main script:
python main.py
๐งช Run tests
Tests are located in the tests/ directory. To run them with pytest:
pytest tests/
or run the Notebook tests/run_test.ipynb
๐ CI/CD Pipeline: Databricks Integration
To ensure the reliability of the code in the production environment, this project implements a Continuous Integration (CI) pipeline using GitHub Actions orchestrated directly with Databricks.
Instead of running tests on a standard runner, the pipeline triggers a remote execution on the Spark cluster.
Workflow Logic
Triggered automatically on every push to main, the workflow performs the following steps:
๐งช Continuous Integration (CI) : Databricks Validation
- Setup: Installs the
databricks-cliand authenticates using secure secrets (DATABRICKS_HOST,DATABRICKS_TOKEN). - Remote Trigger: Initiates the specific Databricks Job (using
Job ID) responsible for running the test suite. - Monitoring: The workflow enters a polling loop, querying the job status via the Databricks API.
- Validation:
- โ
Pass: If the remote job returns a
SUCCESSstate. - โ Fail: If the remote job fails, breaking the CI pipeline to prevent bad code deployment.
- โ
Pass: If the remote job returns a
๐ฆ Continuous Deployment (CD): PyPI Release
Once the Databricks tests pass successfully (SUCCESS state), the pipeline automatically triggers the Deployment Job:
- Build: The project is packaged into a standard distributable format (Wheel
.whland Source.tar.gz) using the Python build backend. - Publish: The artifacts are securely uploaded to PyPI (Python Package Index).
The workflow uses strict dependency logic (needs: databricks-tests), ensuring that broken code is never published.
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_project_databricks-1.0.1.tar.gz.
File metadata
- Download URL: spark_project_databricks-1.0.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fd1e21eb878e44b93b4525e606f83e20b49cb0f69f9844432e70e0eb242d8c9
|
|
| MD5 |
9e1c84bb53d10edfdbb9b9ac98ed6dd5
|
|
| BLAKE2b-256 |
33c6b6af10f1609e5ee450ef9afb2ba3af7a07d9a33bd990eaadc3308eac48d5
|
File details
Details for the file spark_project_databricks-1.0.1-py3-none-any.whl.
File metadata
- Download URL: spark_project_databricks-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2290ded825a90dbfe6e950fc00cff82e16be8ddf542fb0e0cbe9de837d07b66
|
|
| MD5 |
d1fdc78246f0349f7e8299519ef9a61b
|
|
| BLAKE2b-256 |
bd9f6bbc60fa03179f6c5126a1ace301a69860ec333f94c75dd8fcc6f518a099
|