Python API Client
Relevant source files
The following files were used as context for generating this wiki page:
The Python API Client serves as the primary orchestration layer for interacting with Oracle Warehouse Management Systems (WMS) and executing DBT-based data transformations. It encapsulates complex workflows involving entity discovery, data extraction, validation, and pipeline execution by coordinating between flext-oracle-wms for data access and flext-meltano for transformation execution.
Sources: src/flext_dbt_oracle_wms/_utilities/client.py:1-20, src/flext_dbt_oracle_wms/_simple_api_workflow.py:15-30
Client Architecture
The client follows a structured pattern using protocols to define integration points and a facade-based implementation to simplify complex operations. It is composed of the core FlextDbtOracleWmsClient and various workflow-specific classes like FlextDbtOracleWmsWorkflow.
Core Components
| Component | Responsibility |
|---|---|
FlextDbtOracleWmsClient | Orchestrates WMS data fetching, validation, and DBT transformation triggers. |
FlextMeltanoLibraryRunner | Manages the execution of DBT models via the Meltano framework. |
FlextDbtOracleWmsTransformer | Handles business rule validation and entity data preparation for DBT. |
OracleWms.Client | The underlying domain client used for raw communication with the Oracle WMS API. |
Sources: src/flext_dbt_oracle_wms/_utilities/client.py:23-38, src/flext_dbt_oracle_wms/protocols.py:20-45
Interface Definition
The client's public surface is governed by the Client protocol within the DbtOracleWms namespace, ensuring a consistent interface for entity discovery and data extraction.
The diagram shows the relationship between the public Protocol and its concrete implementation.
Sources: src/flext_dbt_oracle_wms/protocols.py:24-52, src/flext_dbt_oracle_wms/_utilities/client.py:23-35
Primary Workflows
Full Pipeline Execution
The client provides a high-level method to run a complete "Discover -> Extract -> Validate -> Transform" pipeline. This process ensures data integrity by checking required fields before passing data to the transformation engine.
Flow showing the sequence of operations in the full Oracle WMS to DBT pipeline.
Sources: src/flext_dbt_oracle_wms/_utilities/client.py:59-97
Connectivity and Health Checks
The client includes health check capabilities to verify communication with the Oracle WMS environment. It retrieves environment settings (base URL, credentials) and executes a health_check() call via the domain client.
def test_oracle_wms_connection(self) -> p.Result[m.Dict]:
client_result = self._get_wms_client()
if client_result.failure:
return r[m.Dict].fail(client_result.error or "WMS client unavailable")
health_result = client_result.value.health_check()
return r[m.Dict].ok(
m.Dict.model_validate({
"status": "connected",
"environment": self.settings.oracle_wms_environment,
"status_code": health_result.value.status_code,
}),
)
Sources: src/flext_dbt_oracle_wms/_utilities/client.py:102-125
Workflow Management
The FlextDbtOracleWmsWorkflow class provides service-level operations, including tracking workflow execution and generating DBT models dynamically from WMS metadata.
Workflow Orchestration Sequence
Sequence of interaction during a high-level workflow execution.
Sources: src/flext_dbt_oracle_wms/_simple_api_workflow.py:32-105
Data Validation Logic
Data extracted from WMS is validated against configured entity requirements. The client checks for:
- Presence of records: Fails if no records are returned.
- Required fields: Checks every record against
required_fields_per_entitydefined in settings. - Business rules: Invokes
validate_business_rulesfrom the transformer model.
Sources: src/flext_dbt_oracle_wms/_utilities/client.py:156-180
Configuration and Initialization
The client initializes lazily, caching the underlying WMS client to avoid redundant setup operations. It leverages FlextDbtOracleWmsSettings for environment-specific configuration.
| Parameter | Type | Description |
|---|---|---|
oracle_wms_base_url | str | The endpoint for the target Oracle WMS instance. |
oracle_wms_environment | str | The target environment (e.g., dev, prod). |
required_fields_per_entity | Mapping | Definitions of mandatory fields for WMS entities. |
Sources: src/flext_dbt_oracle_wms/_utilities/client.py:182-205, src/flext_dbt_oracle_wms/_simple_api_base.py:21-45
Summary
The Python API Client for flext-dbt-oracle-wms provides a unified interface for warehouse data integration. By abstracting the complexities of Meltano execution and Oracle WMS API protocols into a simple Pythonic facade, it enables reliable data pipelines that are validated at every stage from extraction to final SQL transformation.
Sources: src/flext_dbt_oracle_wms/_utilities/client.py:92-97, src/flext_dbt_oracle_wms/_simple_api_workflow.py:126-130