Environment:173TECH Sayn Python 3 8 Plus
| Knowledge Sources | |
|---|---|
| Domains | Data_Engineering, Python |
| Last Updated | 2026-10-17 00:00 GMT |
Overview
Cross-platform Python 3.8+ runtime with Jinja2, SQLAlchemy 1.4, pydantic 1.9, and Click 8.0 for the SAYN data-modelling framework.
Description
This environment provides the base Python runtime required to install and run SAYN. It targets Python >= 3.8.1 (tested through 3.12) on Linux, macOS, and Windows. The core dependency stack includes Jinja2 for SQL template compilation, SQLAlchemy 1.4.x (not 2.0+) for database abstraction, pydantic 1.9.x (not 1.10+) for YAML config validation, ruamel.yaml for settings parsing, Click 8.0.4 for the CLI, and Halo/colorama for console logging. Database drivers (psycopg2, PyMySQL, snowflake-sqlalchemy, etc.) are optional extras installed per target database.
Usage
Use this environment for any SAYN project — the base Python runtime is a mandatory prerequisite for every Implementation in the framework. Install SAYN with `pip install sayn` (core only, SQLite support) or `pip install "sayn[postgresql]"` to include optional database drivers.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | CI tested on all three |
| Python | >= 3.8.1, <= 4.0 | Tested on 3.8, 3.9, 3.10, 3.11, 3.12 |
| Disk | Minimal | Space for compiled SQL output in `compile/` folder |
| Hardware | Any modern CPU | No GPU required; framework is CPU-only |
Dependencies
System Packages
- Python >= 3.8.1 with pip
- A C compiler may be required for building `psycopg2` from source (use `psycopg2-binary` to avoid this)
Python Packages (Core)
- `Jinja2` >= 3.1.3
- `SQLAlchemy` >= 1.4.25, < 2.0.0
- `pydantic` >= 1.9.0, < 1.10.0
- `ruamel.yaml` >= 0.18.5
- `ruamel.yaml.clib` >= 0.2.8
- `orjson` >= 3.9.10
- `Click` = 8.0.4
- `halo` = 0.0.31
- `colorama` >= 0.4.4
Python Packages (Optional Database Drivers)
- `psycopg2` >= 2.9.9 (PostgreSQL) or `psycopg2-binary` >= 2.9.9
- `PyMySQL` >= 1.0.2 (MySQL)
- `snowflake-sqlalchemy` >= 1.5.1 (Snowflake)
- `sqlalchemy-bigquery` >= 1.9.0 (BigQuery)
- `google-cloud-bigquery-storage` >= 2.24.0, < 3.0.0 (BigQuery bulk loading)
- `redshift-connector` >= 2.0.918 (Redshift)
- `sqlalchemy-redshift` >= 0.4.1 (Redshift)
- `graphviz` >= 0.19.1 (optional DAG visualisation)
Credentials
The following environment variables can be set to override `settings.yaml` at runtime:
- `SAYN_PARAMETER_{NAME}` — Override a project parameter value
- `SAYN_CREDENTIAL_{NAME}` — Override a credential definition
- `SAYN_DATABASE_PREFIX` / `SAYN_DATABASE_SUFFIX` / `SAYN_DATABASE_OVERRIDE` — Dev/prod database name transformation
- `SAYN_SCHEMA_PREFIX` / `SAYN_SCHEMA_SUFFIX` / `SAYN_SCHEMA_OVERRIDE` — Dev/prod schema name transformation
- `SAYN_TABLE_PREFIX` / `SAYN_TABLE_SUFFIX` / `SAYN_TABLE_OVERRIDE` — Dev/prod table name transformation
- `SAYN_FROM_PROD` — Comma-separated glob patterns for from-prod source resolution
- `SAYN_DEFAULT_RUN` — Default CLI task selection (`-t`, `-x`, `-u` syntax)
Database credentials (host, user, password, etc.) are defined in `settings.yaml`, not environment variables.
Quick Install
# Core installation (SQLite only)
pip install sayn
# With specific database driver
pip install "sayn[postgresql]"
pip install "sayn[postgresql-binary]"
pip install "sayn[redshift]"
pip install "sayn[mysql]"
pip install "sayn[snowflake]"
pip install "sayn[bigquery]"
pip install "sayn[graphviz]"
# All optional extras
pip install "sayn[all]"
# From source (development)
pip install poetry==1.3.2
poetry install
Code Evidence
Python version constraint from `pyproject.toml:15`:
python = ">= 3.8.1, <= 4.0"
CI test matrix from `.github/workflows/workflow.yml:29`:
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
SQLAlchemy version constraint (locked to 1.x) from `pyproject.toml:20`:
SQLAlchemy = ">=1.4.25,<2.0.0"
pydantic version constraint (locked to 1.x) from `pyproject.toml:22`:
pydantic = ">=1.9.0,<1.10.0"
Environment variable parsing regex from `sayn/core/settings.py:14-19`:
RE_ENV_VAR_NAME = re.compile(
r"SAYN_((?P<stringify>(DATABASE|SCHEMA|TABLE)_(PREFIX|SUFFIX|OVERRIDE))"
r"|(?P<from_prod>FROM_PROD)$"
r"|(?P<default_run>DEFAULT_RUN)$"
r"|(?P<type>PARAMETER|CREDENTIAL)_(?P<name>.+))$"
)
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `No driver for {type} found` | Database type not recognised | Install the correct optional extra (e.g. `pip install "sayn[postgresql]"`) |
| `ImportError: No module named 'psycopg2'` | PostgreSQL driver not installed | `pip install "sayn[postgresql]"` or `pip install "sayn[postgresql-binary]"` |
| `ImportError: No module named 'snowflake.sqlalchemy'` | Snowflake driver not installed | `pip install "sayn[snowflake]"` |
| `ModuleNotFoundError: No module named 'boto3'` | boto3 not installed for Redshift S3 loading | `pip install boto3` separately |
| Pydantic v2 installed instead of v1 | Version constraint not respected | Ensure `pydantic < 1.10.0` is installed; SAYN uses pydantic v1 API |
| SQLAlchemy 2.x installed | Version constraint not respected | Ensure `SQLAlchemy < 2.0.0`; SAYN uses SQLAlchemy 1.4 API |
Compatibility Notes
- SQLAlchemy 2.x: Not supported. SAYN is pinned to SQLAlchemy >= 1.4.25, < 2.0.0 and uses the 1.x API (e.g. `engine.execute()`).
- pydantic 2.x: Not supported. SAYN is pinned to pydantic >= 1.9.0, < 1.10.0 and uses the v1 API (e.g. `BaseModel`, `validator`).
- Click: Pinned to exactly 8.0.4; newer Click versions may introduce breaking changes.
- Windows: CI tested but may require WSL for some database drivers.
- SQLite: Always available with the base install; no extra driver needed.
Related Pages
- Implementation:173TECH_Sayn_TestTask
- Implementation:173TECH_Sayn_PythonTask
- Implementation:173TECH_Sayn_DbObjectCompiler
- Implementation:173TECH_Sayn_SqlTask
- Implementation:173TECH_Sayn_Compiler
- Implementation:173TECH_Sayn_App_set_tasks
- Implementation:173TECH_Sayn_CopyTask
- Implementation:173TECH_Sayn_PythonLoader
- Implementation:173TECH_Sayn_Database_etl
- Implementation:173TECH_Sayn_read_settings