Repository for SQLAlchemy models with Alembic migrations
Project description
Data-Models
- Repository for managing the shared SQLAlchemy / SQLModel Data Models and Alembic migrations
- This repo gets automatically build, tested and published
- Might be renamed to include other shared backend code later
- The Models are used in:
- Pipelines & Automations
- Internal websites API
- Helpertool
- For generel explanation of tooling & setup see our notion page
Developer Setup
1. Prerequisites
This project uses uv for package and environment management
Install uv:
- macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
- Windows (PowerShell):
irm https://astral.sh/uv/install.ps1 | iex
2. Initial Project Setup
These commands will set up your virtual environment, install dependencies, and enable automated quality checks.
# 1. Create a virtual environment in a .venv directory
uv venv
# 2. Activate the virtual environment
# macOS / Linux
source .venv/bin/activate
# Windows (PowerShell)
.venv\Scripts\Activate.ps1
# 3. Install all dependencies in "editable" mode
uv pip install -e ".[dev]"
# 4. Install the pre-commit hooks for automated quality checks
pre-commit install
Your environment is now ready. The editable install (-e) means that changes you make to the source code are immediately available without reinstalling.
3. VSCode Integration
To get the best experience (live error-checking, auto-formatting), configure VSCode to use the project's environment.
-
Install Recommended Extensions:
Python(by Microsoft)Ruff(by Astral)Mypy Type Checker(by Microsoft)
-
Select the Python Interpreter:
- Open the Command Palette:
Ctrl+Shift+P(orCmd+Shift+Pon Mac). - Run the
Python: Select Interpretercommand. - Choose the interpreter located in the
./.venvdirectory. This is critical for all editor integrations to work.
- Open the Command Palette:
Once the interpreter is selected, our project's .vscode/settings.json file will automatically enable formatting on save, import sorting, and type-checking.
4. Running Tests
To run the full test suite, simply use pytest:
pytest
If you run into "command not found" for pytest, install dev requirements first in your project's virtualenv:
PowerShell:
.venv\Scripts\Activate.ps1
uv pip install -e ".[dev]"
pytest -q
5. Formatting and Linting
- If you want to invoke the pre-commit formatting and type-checking explicitly, activate the environment and run
pre-commit run --all-files
# For ruff hecks only
ruff check .
ruff format
# For MyPy static type checking only
mypy .
Local Development Across Projects
Often, you'll need to test changes from this data-models repository in another service (e.g., Internal-API) before publishing a new version. Here’s how to link them locally.
Scenario: You've made changes in data-models and want Internal-API to use them instantly.
-
Navigate to your other project's directory:
cd ../Internal-API
-
Activate its virtual environment:
source .venv/bin/activate
-
Uninstall any existing version of
data-models: This prevents conflicts with a version installed from the registry.uv pip uninstall data-models
-
Install your local
data-modelsin editable mode using a relative path:# This command creates a direct link to your local data-models source code uv pip install -e ../data-models
Now, Internal-API is linked to your local data-models folder. Any code you change in data-models will be immediately reflected when you run Internal-API.
Deployment
- This Repo manages all DB migrations to the main DB and applies them on pushes to main
- Best practice would be
- blue/green testing & only implementing backwards compatible migrations with legacy fields being deprecated later
- Integration tests on staging version
- Trigger rebuilds & deployment of downstream applications on pushes to main
Docs
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 ec_data_models-0.1.0rc1.tar.gz.
File metadata
- Download URL: ec_data_models-0.1.0rc1.tar.gz
- Upload date:
- Size: 45.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e2074bf7462c7943804b2fea6397fba84d53b97b752df357e6f2dc7df4b4e5d
|
|
| MD5 |
b3cc13e1123e3df7c5ce6dc9ac7e394c
|
|
| BLAKE2b-256 |
627f9b48b6e10975633f1bfffbe9147d8221cfcb3fc5ce41fa43b2b996e2de5d
|
File details
Details for the file ec_data_models-0.1.0rc1-py3-none-any.whl.
File metadata
- Download URL: ec_data_models-0.1.0rc1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd5f0c555ee4a57d88b6be085a7fbeda2467eb26e27c3a5076ac253b0c6f6936
|
|
| MD5 |
04a71949bae70b3848e2c325ed4e2681
|
|
| BLAKE2b-256 |
0b32d1c67f1eb73c71edb34bed361e7e350b75bf3facaa93df795246a02f69e0
|