Singer Target Base
Relevant source files
The following files were used as context for generating this wiki page:
The Singer Target Base within the flext-target-oracle-oic repository provides the foundational infrastructure for implementing a Singer-compliant data target specifically designed for Oracle Integration Cloud (OIC). It leverages the FLEXT ecosystem, specifically flext-meltano and singer-sdk, to provide a structured, typed, and scalable way to load data into OIC entities like connections, integrations, packages, and lookups.
This base architecture establishes the contract for how data records and batches are processed, how stream-specific sinks are resolved, and how authentication with Oracle IDCS (Identity Cloud Service) is managed. By inheriting from FlextMeltanoTargetAbstractions, the target gains standardized lifecycle management, including setup and teardown routines required for enterprise ETL workflows.
Sources: src/flext_target_oracle_oic/target.py:17-21, src/flext_target_oracle_oic/api.py:16-20, README.md:9-11
Core Architecture and Inheritance
The project follows a hierarchical inheritance model to combine Singer SDK standards with FLEXT-specific observability and utility features. The primary entry point, FlextTargetOracleOic, coordinates multiple stream-specific sinks.
Class Hierarchy
The following diagram illustrates the relationship between the base Singer classes and the OIC-specific implementations.
Sink Implementations
Sinks are responsible for the actual processing of data received from a Singer Tap. The FlextTargetOracleOicBaseSink provides default logging and batch handling logic that is shared across all OIC data streams.
Supported OIC Streams
The target maps specific Singer stream names to dedicated sink classes to handle varying data models:
| Stream Name | Sink Class | Description |
|---|---|---|
connections | FlextTargetOracleOicConnectionsSink | Manages OIC connection metadata and adapter configurations. |
integrations | FlextTargetOracleOicIntegrationsSink | Handles OIC integration flows and archive content. |
packages | FlextTargetOracleOicPackagesSink | Manages OIC package bundles. |
lookups | FlextTargetOracleOicLookupsSink | Handles OIC lookup tables and versioning. |
Sources: src/flext_target_oracle_oic/target.py:46-74, tests/unit/test_e2e_sinks.py:38-48
Record Processing Flow
When a record is received, the sink performs metadata extraction and prepares the data for OIC API consumption. The process is overseen by the FlextTargetOracleOicService.
Authentication and Utilities
The Target Base relies on a robust authentication mechanism to interact with Oracle Integration Cloud. The Authenticator class within utilities.py manages OAuth2 client credentials flows.
OAuth2 Authentication Process
The target uses the client_credentials grant type to obtain Bearer tokens from the Oracle Identity Cloud Service (IDCS).
- Configuration Loading: The system validates required fields:
base_url,oauth_client_id, andoauth_client_secret. - Token Request: A POST request is sent to the
oauth_token_urlwith the client credentials and optionalscopeoraudience. - Token Management: The token is cached and automatically added to the
Authorizationheader for subsequent OIC API calls.
Sources: src/flext_target_oracle_oic/utilities.py:70-125, tests/unit/test_target.py:87-105
Key Utility Functions
| Category | Method | Purpose |
|---|---|---|
| Validation | validate_config | Ensures all mandatory OIC credentials are present before execution. |
| Authentication | get_access_token | Handles token retrieval, error checking, and token type identification. |
| Factory | create_oic_connection | Validates generic input JSON against the OIC Connection Pydantic model. |
| Service | create_sink | Internal runtime adapter for creating sinks via the service facade. |
Sources: src/flext_target_oracle_oic/utilities.py:25-68, src/flext_target_oracle_oic/_utilities/service_runtime.py:22-48
Service Orchestration
The FlextTargetOracleOicService acts as a facade, orchestrating the lifecycle of the target within a microservice or containerized environment. It extends FlextMeltanoTargetServiceBase, providing a thin layer that specifically overrides create_sink to inject OIC-specific runtime configurations.
# From src/flext_target_oracle_oic/api.py
@override
def create_sink(
self,
stream_name: str,
schema: t.JsonMapping,
) -> p.Meltano.SingerDrainSink:
"""Create an Oracle OIC sink for a stream."""
target_config: t.JsonMapping = self.settings_overrides or {}
return FlextTargetOracleOicServiceRuntime.create_sink(
stream_name=stream_name,
schema=schema,
target_config=target_config,
)
Sources: src/flext_target_oracle_oic/api.py:30-42, src/flext_target_oracle_oic/_utilities/service_runtime.py:13-17
Conclusion
The Singer Target Base for Oracle OIC provides a highly structured framework for data movement into Oracle's integration ecosystem. By centralizing authentication, stream resolution, and sink behavior into a shared base, the project ensures consistent data handling and simplified extension for new OIC features. The use of FLEXT abstractions allows the target to function both as a standalone CLI tool and as a managed service within a larger ETL pipeline.