Data Platform Toolbox (DPT)
This tool has been created in order to more efficiently work with the Data Platform. There are 4 tools in this package:
- CLI - A CLI tool that allows the user to compile any DBT model for any environment
- notebook_sql - A package that allows SQL queries to be executed inside of a Python notebook
- validation:snowflake - A package that uses snowpark code to perform comparisons between two tables
- validation:report - A package that uses pandas code to perform comparisons between two DataFrames (and can generate an excel report)
Setup
To use this package you have the option to copy the entire dpt folder to a new domain, and install the package in 'development' mode. This allows you to edit/adapt the code to your personal needs. Alternatively you can build a python "wheel", which is a single distributable file, which you can then install into the new domain repo like any other python package.
Prerequisites
This setup assumes you have already setup a Python virtual environment with all necessary DBT packages installed.
- Python 3.11
- Virtual environment setup & active
- VS Code Jupyter extension
- VS Code Python extension
Wheel
This Repo
In your terminal, navigate to the dpt directory
cd dpt
Make sure the Python building tools are up to date
python -m pip install --upgrade pip build twine
Build the wheel
python -m build --wheel
Destination Repo
Copy and paste the wheel into the root directory of the destination repo
Install the wheel (replace <path-to-wheel-file> with actual wheel file name)
pip install <path-to-wheel-file>
"Development" Mode
Copy and paste the entire dpt folder/directory into the root directory of the destination repo
Destination Repo
Navigate to the dpt directory
cd dpt
Install the dpt package in interactive mode
pip install -e . --index-url https://proget.pggm-intra.intern/pypi/PGGMPythonGallery/simple --trusted-host proget.pggm-intra.intern
Any changes you make to the python files in the dpt repo will immediatly change the behavior of the dpt package wherever it is being used (CLI, Python script, Jupyter Notebook, etc.)
Usage
CLI
The CLI can be used from the terminal to compile any model to any environment. It uses the same syntax as the dbt CLI, for example to compile a model using dbt you would use
dbt compile -s <model-name>
Example:
dbt compile -s pre_date_date
The dpt CLI works similar, you can use the exact same syntax to compile a model
dpt compile -s <model-name>
Example:
dpt compile -s pre_date_date
The formatting of the output is nicer, and the compiled query is automatically copied to your clipboard. What the CLI does under the hood is, it sends of a dbt compile command in a virtual terminal. It then looks for the compiled SQL code in the target directory. If you want to see the actual dbt command being sent out you can use the --verbose (shorthand -v) flag
dpt compile -s <model-name> --verbose
Example:
dpt compile -s pre_date_date --verbose
The real power of the CLI is being able to compile sql code for the PRD environment. You can compile the code to any environment using the --env (shorthand -e) flag.
dpt compile -s <model-name> --env <environment-name>
Example:
dpt compile -s pre_date_date --env PRD
Validation & Notebooks
Example Jupyter notebooks are bundled with the package and can be extracted to your project using the CLI.
List available examples
dpt examples --list
Copy examples to the current directory
dpt examples
This creates a dpt_examples/ folder containing:
- sql_notebook/ — Demonstrates how to run SQL queries in Jupyter notebooks using the
%%sqlmagic command, mix SQL with Python, and save results. - validation/ — Shows how to compare tables in Snowflake and generate Excel comparison reports.
Metadata
Release files for pggm-dpt-toolkit 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pggm_dpt_toolkit-1.0.2.tar.gz | 55.1 kB | Without provenance | Details for pggm_dpt_toolkit-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pggm_dpt_toolkit-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for pggm_dpt_toolkit-1.0.2-py3-none-any.whl |
Total release size: 117.3 kB
Release files / pggm_dpt_toolkit-1.0.2.tar.gz
| Download URL | pggm_dpt_toolkit-1.0.2.tar.gz |
|---|---|
| Size | 55.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09cf9d902028f2258672b84327e6c7acbc8ac7aff6035bcc7c1e1adb5d00b69a
|
|
BLAKE2b-256 checksum How to use checksums |
135b5b02c01c9a5c3e084e0f3bcc25d62e61ecb7ccd70be2789608bf1c05706a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.13
|
Release files / pggm_dpt_toolkit-1.0.2-py3-none-any.whl
| Download URL | pggm_dpt_toolkit-1.0.2-py3-none-any.whl |
|---|---|
| Size | 62.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bc05861e4cc215b5bf15ca5857902aa83eb1350b610261a22aadfbcd8544d9b
|
|
BLAKE2b-256 checksum How to use checksums |
22f031ea442c9b8915ce5a2e119204de5a7ce1065c893e5e74a6d03013af44d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.13
|
Security for pggm-dpt-toolkit 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.