Flext Core Integration
Relevant source files
The following files were used as context for generating this wiki page:
Flext Core Integration represents the architectural foundation of the flext-dbt-oracle adapter, which provides modern dbt models and connectivity for Oracle Databases. This integration leverages the flext-core framework to implement standardized settings, typed models, and shared service patterns. It ensures that the Oracle dbt adapter follows the "modern dbt only" philosophy, adhering to adapter_api_version: v12 and strictly avoiding legacy PostgreSQL dependencies.
Sources: rules.json:1-12, pyproject.toml:25-35, README.md:10-15
Architecture and Inheritance Hierarchy
The integration is built upon a strictly defined Method Resolution Order (MRO) that cascades from flext-core through specialized intermediate libraries like flext-db-oracle and flext-meltano. This structure allows flext-dbt-oracle to inherit robust database utilities and extraction patterns while specializing them for dbt workflows.
Class Hierarchy and MRO
The following diagram illustrates how the core service and model components inherit functionality from the Flext ecosystem.
The diagram shows the vertical inheritance from core libraries into the Oracle-specific dbt implementation.
Sources: src/flext_dbt_oracle/base.py:16-20, src/flext_dbt_oracle/settings.py:15-20, src/flext_dbt_oracle/models.py:15-18, src/flext_dbt_oracle/utilities.py:13-15
Settings and Configuration Management
The integration uses FlextSettingsBase to manage environment-aware configurations. The FlextDbtOracleSettings class acts as the single source of truth for runtime parameters, utilizing Pydantic for validation and automatic environment variable mapping via the FLEXT_DBT_ORACLE_ prefix.
Key Configuration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
oracle_host | str | localhost | Oracle database host address. |
oracle_port | int | 1521 | Oracle database listener port. |
oracle_service_name | str | XEPDB1 | Oracle service identifier. |
materialization | Literal | table | dbt materialization strategy (table, view, etc.). |
pool_max_size | int | 10 | Maximum size for the connection pool. |
query_timeout | int | 300 | Timeout for SQL execution in seconds. |
Sources: src/flext_dbt_oracle/settings.py:27-100, rules.json:144-153
Connection String Construction
The integration provides computed properties to generate Oracle-compliant connection strings and DSNs dynamically based on whether a Service Name or SID is provided.
This logic ensures compatibility with various Oracle listener configurations.
Sources: src/flext_dbt_oracle/settings.py:165-175, src/flext_dbt_oracle/models.py:118-135
Service Foundation and dbt Profiling
The FlextDbtOracleServiceBase serves as the shared foundation for all dbt-related operations. It manages the lifecycle of settings and translates internal configurations into the JSON-compatible profiles required by dbt.
Connection Profile Logic
The connection_profile property explicitly maps internal settings to the Oracle dbt adapter format:
- Type: Hardcoded to
oracle. - Credentials: Maps
oracle_usernameandoracle_password. - Schema: Defaults to the configured
schema_nameor a constant default value. - Service Name: Derived from
oracle_service_name.
Sources: src/flext_dbt_oracle/base.py:32-46
Data Models and Model Generation
The integration defines a structured namespace FlextDbtOracleModels.DbtOracle to handle dbt-specific metadata and automated SQL generation.
Staging Model Generation
A core feature is the ModelGenerator, which automates the creation of staging models based on source tables.
Sources: src/flext_dbt_oracle/models.py:53-73
Model Metadata Structure
The DbtOracle.Model class defines the schema for a dbt model definition within the Flext framework:
name: The unique dbt model identifier.materialization: An enum-based strategy (e.g.,table,view,incremental).sql_content: The raw SQL body including Jinja templates.dependencies: A sequence of strings representing upstream models.
Sources: src/flext_dbt_oracle/models.py:25-50
Utility Facades
Utilities in flext-dbt-oracle extend FlextDbOracleUtilities to provide higher-level pipeline execution logic. The DbtOracle.Client facade provides methods for table discovery and extraction pipeline execution.
Pipeline Flow
- Discovery:
discover_tables()returns candidate tables (e.g., customers, orders). - Extraction:
extract_table_data()simulates data retrieval. - Execution:
run_pipeline()orchestrates discovery and extraction into a unified status payload.
Sources: src/flext_dbt_oracle/utilities.py:27-56
Summary of Core Integration Components
| Component | Responsibility | Base Implementation |
|---|---|---|
| Settings | Env-driven configuration and validation | FlextSettingsBase |
| Service Base | dbt project context and profiling | FlextMeltanoDbtServiceBase |
| Models | Typed dbt metadata and automated SQL gen | FlextMeltanoModels, m.Value |
| Utilities | Connection testing and pipeline execution | FlextDbOracleUtilities |
Sources: src/flext_dbt_oracle/base.py:16-30, src/flext_dbt_oracle/models.py:15-22, src/flext_dbt_oracle/settings.py:15-25
Conclusion
The Flext Core Integration for flext-dbt-oracle establishes a rigid, type-safe architecture for interacting with Oracle databases via dbt. By centralizing settings in Pydantic-backed classes and enforcing a strict inheritance model, the system provides a predictable and scalable environment for enterprise data transformation workflows.