Data Models & Schemas
Relevant source files
The following files were used as context for generating this wiki page:
The flext-target-oracle-oic project implements a Singer-compliant target for Oracle Integration Cloud (OIC). Its data models and schemas define the structure for OIC resources including connections, integrations, packages, lookups, and projects. These models ensure that incoming data from Singer taps is validated and transformed into payloads compatible with the Oracle Integration Cloud REST APIs.
Sources: src/flext_target_oracle_oic/models.py:1-12, src/flext_target_oracle_oic/target.py:1-15
Domain Model Architecture
The data models are organized within the FlextTargetOracleOicModels namespace, which inherits from Meltano and Oracle OIC base models. This structure provides Pydantic-based validation and type safety for various OIC entities.
This diagram illustrates the relationship between the primary domain models and their inheritance from the Pydantic-based ArbitraryTypesModel.
Sources: src/flext_target_oracle_oic/models.py:15-85
Core Data Structures
The system handles several specific OIC resource types, each with its own schema requirements defined in src/flext_target_oracle_oic/models.py.
Resource Field Definitions
| Model | Field | Type | Description |
|---|---|---|---|
| OICConnection | id | NonEmptyStr | Unique connection identifier |
name | NonEmptyStr | Connection name | |
adapter_type | NonEmptyStr | Type of adapter used (e.g., REST) | |
properties | JsonMapping | Connection properties and configuration | |
| OICIntegration | id | NonEmptyStr | Unique integration identifier |
name | NonEmptyStr | Integration name | |
version | str | Integration version (Default: 1.0) | |
pattern | str | Integration pattern type | |
| OICPackage | id | NonEmptyStr | Unique package identifier |
name | NonEmptyStr | Package name | |
version | str | Package version | |
| OICLookup | name | NonEmptyStr | Lookup name |
columns | tuple | Column definitions for the lookup | |
rows | tuple | Row data for the lookup |
Sources: src/flext_target_oracle_oic/models.py:20-75
Data Flow and Factory Logic
The project uses factory methods to transform raw JSON payloads from Singer messages into validated Pydantic model instances. This ensures that only valid data proceeds to the OIC API sinks.
The flow shows how incoming records are routed through factory validation before being dispatched as API requests.
Sources: src/flext_target_oracle_oic/utilities.py:34-70, src/flext_target_oracle_oic/target.py:24-40
Validation Logic
The FlextTargetOracleOicModels.validate_connection method enforces business rules beyond basic type checking, such as ensuring that identifier strings are not just whitespace.
@staticmethod
def validate_connection(
connection: TargetOracleOic.OICConnection,
) -> p.Result[bool]:
"""Validate minimal connection invariants."""
if not connection.id.strip() or not connection.name.strip():
return r[bool].fail("Connection id/name cannot be empty")
return r[bool].ok(value=True)
Sources: src/flext_target_oracle_oic/models.py:87-94
Configuration Schema
The project configuration is governed by FlextTargetOracleOicSettings. This schema defines the mandatory credentials and URLs required for the target to communicate with OIC.
| Setting | Type | Required | Description |
|---|---|---|---|
base_url | string | Yes | The OIC instance base URL |
oauth_token_url | string | Yes | The URL used to request OAuth2 tokens |
oauth_client_id | string | Yes | OAuth2 Client ID |
oauth_client_secret | string | Yes | OAuth2 Client Secret |
oauth_scope | string | No | Optional OAuth2 scope |
oauth_client_aud | string | No | Optional Audience parameter |
Sources: src/flext_target_oracle_oic/utilities.py:23-32, tests/unit/test_e2e.py:36-50
Sink to Stream Mapping
The FlextTargetOracleOic class maintains a mapping between Singer stream names and their corresponding sink classes, which utilize the models defined above.
| Stream Name | Sink Class | Primary Model |
|---|---|---|
connections | FlextTargetOracleOicConnectionsSink | OICConnection |
integrations | FlextTargetOracleOicIntegrationsSink | OICIntegration |
packages | FlextTargetOracleOicPackagesSink | OICPackage |
lookups | FlextTargetOracleOicLookupsSink | OICLookup |
Sources: src/flext_target_oracle_oic/target.py:65-71, tests/unit/test_e2e_sinks.py:38-43
Summary
The Data Models and Schemas in flext-target-oracle-oic provide a robust framework for translating generic data streams into structured Oracle Integration Cloud entities. By leveraging Pydantic models within a domain-specific namespace and utilizing strict validation factories, the system ensures data integrity throughout the ingestion process. This architecture allows the target to handle complex resources like Integrations and Lookups while maintaining a consistent configuration interface for the user.