Configuration API¶
odibi.config
¶
Configuration models for ODIBI framework.
ConnectionConfig = Annotated[Union[Annotated[LocalConnectionConfig, Tag(ConnectionType.LOCAL.value)], Annotated[AzureBlobConnectionConfig, Tag(ConnectionType.AZURE_BLOB.value)], Annotated[DeltaConnectionConfig, Tag(ConnectionType.DELTA.value)], Annotated[UnityCatalogConnectionConfig, Tag(ConnectionType.UNITY_CATALOG.value)], Annotated[SQLServerConnectionConfig, Tag(ConnectionType.SQL_SERVER.value)], Annotated[HttpConnectionConfig, Tag(ConnectionType.HTTP.value)], Annotated[CustomConnectionConfig, Tag(_CUSTOM_CONNECTION_TAG)]], Discriminator(_connection_discriminator)]
module-attribute
¶
EngineType
¶
ConnectionType
¶
WriteMode
¶
Bases: str, Enum
Write modes for output operations.
Values:
* overwrite - Replace all existing data. Use for full refresh, dimensions.
* append - Add rows without checking for duplicates. Use for true append-only logs.
* upsert - Update existing rows by key, insert new. Use for Silver/Gold with updates.
* append_once - Insert only rows where keys don't exist (idempotent). Recommended for Bronze ingestion. Requires keys in write options. Safe to retry/rerun without creating duplicates.
* merge - SQL Server MERGE via staging table + T-SQL MERGE statement.
Choosing the right mode:
| Mode | Existing Keys | New Keys | Use Case |
|---|---|---|---|
| overwrite | Deleted | Inserted | Full refresh, dimensions |
| append | Duplicated | Inserted | True append-only logs |
| upsert | Updated | Inserted | Silver/Gold with updates |
| append_once | Skipped | Inserted | Idempotent Bronze ingestion |
| merge | Updated | Inserted | SQL Server targets |
Source code in odibi/config.py
AlertConfig
¶
Bases: BaseModel
Configuration for alerts with throttling support.
Supports Slack, Teams, and generic webhooks with event-specific payloads.
Available Events:
- on_start - Pipeline started
- on_success - Pipeline completed successfully
- on_failure - Pipeline failed
- on_quarantine - Rows were quarantined
- on_gate_block - Quality gate blocked the pipeline
- on_threshold_breach - A threshold was exceeded
Example:
alerts:
- type: slack
url: "${SLACK_WEBHOOK_URL}"
on_events:
- on_failure
- on_quarantine
- on_gate_block
metadata:
throttle_minutes: 15
max_per_hour: 10
channel: "#data-alerts"
Source code in odibi/config.py
TransformConfig
¶
Bases: StrictModel
Configuration for transformation steps within a node.
When to Use: Custom business logic, data cleaning, SQL transformations.
Key Concepts:
- steps: Ordered list of operations (SQL, functions, or both)
- Each step receives the DataFrame from the previous step
- Steps execute in order: step1 → step2 → step3
See Also: Transformer Catalog
Transformer vs Transform:
- transformer: Single heavy operation (scd2, merge, deduplicate)
- transform.steps: Chain of lighter operations
🔧 "Transformation Pipeline" Guide¶
Business Problem: "I have complex logic that mixes SQL for speed and Python for complex calculations."
The Solution: Chain multiple steps together. Output of Step 1 becomes input of Step 2.
Function Registry:
The function step type looks up functions registered with @transform (or @register).
This allows you to use the same registered functions as both top-level Transformers and steps in a chain.
Recipe: The Mix-and-Match
transform:
steps:
# Step 1: SQL Filter (Fast)
- sql: "SELECT * FROM df WHERE status = 'ACTIVE'"
# Step 2: Custom Python Function (Complex Logic)
# Looks up 'calculate_lifetime_value' in the registry
- function: "calculate_lifetime_value"
params: { discount_rate: 0.05 }
# Step 3: Built-in Operation (Standard)
- operation: "drop_duplicates"
params: { subset: ["user_id"] }
Source code in odibi/config.py
ValidationConfig
¶
Bases: StrictModel
Configuration for data validation (post-transform checks).
When to Use: Output data quality checks that run after transformation but before writing.
See Also: Validation Guide, Quarantine Guide, Contracts Overview (pre-transform checks)
🛡️ "The Indestructible Pipeline" Pattern¶
Business Problem: "Bad data polluted our Gold reports, causing executives to make wrong decisions. We need to stop it before it lands."
The Solution: A Quality Gate that runs after transformation but before writing.
Recipe: The Quality Gate
validation:
mode: "fail" # fail (stop pipeline) or warn (log only)
on_fail: "alert" # alert or ignore
tests:
# 1. Completeness
- type: "not_null"
columns: ["transaction_id", "customer_id"]
# 2. Integrity
- type: "unique"
columns: ["transaction_id"]
- type: "accepted_values"
column: "status"
values: ["PENDING", "COMPLETED", "FAILED"]
# 3. Ranges & Patterns
- type: "range"
column: "age"
min: 18
max: 120
- type: "regex_match"
column: "email"
pattern: "^[\w\.-]+@[\w\.-]+\.\w+$"
# 4. Business Logic (SQL)
- type: "custom_sql"
name: "dates_ordered"
condition: "created_at <= completed_at"
threshold: 0.01 # Allow 1% failure
Recipe: Quarantine + Gate
validation:
tests:
- type: not_null
columns: [customer_id]
on_fail: quarantine
quarantine:
connection: silver
path: customers_quarantine
gate:
require_pass_rate: 0.95
on_fail: abort
Source code in odibi/config.py
3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 | |
validate_quarantine_config()
¶
Warn if quarantine config exists but no tests use on_fail: quarantine.
Source code in odibi/config.py
PipelineConfig
¶
Bases: StrictModel
Configuration for a pipeline.
Example:
pipelines:
- pipeline: "user_onboarding"
description: "Ingest and process new users"
layer: "silver"
owner: "data-team@example.com"
freshness_sla: "6h"
nodes:
- name: "node1"
...
Source code in odibi/config.py
5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 | |
auto_populate_depends_on_from_inputs()
¶
Auto-populate depends_on for same-pipeline references in inputs.
If a node has inputs like $silver.other_node and this is the silver pipeline, automatically add 'other_node' to depends_on for correct execution order.
Source code in odibi/config.py
check_unique_node_names(nodes)
classmethod
¶
Ensure all node names are unique within the pipeline.
Source code in odibi/config.py
validate_pipeline_name_format(v)
classmethod
¶
Ensure pipeline names are valid identifiers (alphanumeric + underscore).
Source code in odibi/config.py
StoryConfig
¶
Bases: StrictModel
Story generation configuration.
Stories are ODIBI's core value - execution reports with lineage. They must use a connection for consistent, traceable output.
Example:
story:
connection: "local_data"
path: "stories/"
retention_days: 30
failure_sample_size: 100
max_failure_samples: 500
max_sampled_validations: 5
Failure Sample Settings:
- failure_sample_size: Number of failed rows to capture per validation (default: 100)
- max_failure_samples: Total failed rows across all validations (default: 500)
- max_sampled_validations: After this many validations, show only counts (default: 5)
Source code in odibi/config.py
5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 | |