Constants and Defaults
Relevant source files
The following files were used as context for generating this wiki page:
The flext-tap-oracle project utilizes a structured hierarchy of constants and default configurations to ensure consistent behavior across Oracle database extraction operations. These values govern connection parameters, performance tuning, Singer protocol compliance, and environmental settings. By inheriting from flext-core and flext-db-oracle base constants, the project maintains a unified pattern while providing specific overrides for Oracle-specific requirements.
The architecture relies on nested namespace classes within a central FlextTapOracleConstants class and a schema-driven rules.json file for validation logic. These constants are primarily consumed by the FlextTapOracleSettings class to initialize runtime configurations.
Sources: src/flext_tap_oracle/constants.py:1-25, src/flext_tap_oracle/settings.py:1-30
Core Operational Constants
The project defines essential limits and default values for core Oracle tap operations. These are encapsulated within the FlextTapOracleConstants.TapOracle namespace. Key values include identifier length limits, default stream naming conventions, and initial record states.
| Constant | Value | Description |
|---|---|---|
MAX_PORT_NUMBER | 65535 | Maximum valid TCP port for Oracle connections |
MAX_IDENTIFIER_LENGTH | 255 | Maximum length for database identifiers |
DEFAULT_STREAM_PREFIX | "oracle" | Default prefix prepended to Singer stream names |
INITIAL_RECORD_COUNT | 0 | Baseline count for extraction progress tracking |
Sources: src/flext_tap_oracle/constants.py:27-40
Connection and Connectivity Defaults
The connection layer defaults are defined in both the rules schema and the settings class. The standard Oracle port is set to 1521, and the system supports a variety of SSL modes and timeout configurations.
The diagram shows how hardcoded defaults and schema-based rules flow into the settings layer to configure the Oracle API.
Sources: src/flext_tap_oracle/rules.json:62-80, src/flext_tap_oracle/settings.py:38-60
Performance and Resource Management
Performance constants are categorized by extraction behavior, memory management, and connection pooling. These defaults are designed to optimize throughput while staying within safe resource bounds for enterprise Oracle environments.
Performance Rule Set
The following table outlines the performance thresholds and recommendations used by the tap.
| Category | Parameter | Default Value | Constraints |
|---|---|---|---|
| Extraction | batch_size | 1000 | Min: 1, Max: 50000 |
| Parallelism | max_parallel_streams | 4 | Max: 20 |
| Memory | cursor_array_size | 100 | Fixed default |
| Memory | fetch_size | 1000 | Fixed default |
| Pooling | connection_pool_size | 5 | Max: 50 |
Sources: src/flext_tap_oracle/rules.json:85-115, src/flext_tap_oracle/rules.json:184-205
Circuit Breaker Configuration
To ensure resilience, the tap implements a circuit breaker pattern with the following default constants:
- Failure Threshold: 5 failures before opening the circuit.
- Timeout: 60 seconds.
- Half-Open Max Calls: 3 calls allowed to test recovery.
Sources: src/flext_tap_oracle/rules.json:237-242
Replication Methods and State
Replication is controlled by a type-safe Method enumeration. This provides a single source of truth for the supported Singer replication strategies.
@unique
class Method(StrEnum):
FULL_TABLE = "FULL_TABLE"
INCREMENTAL = "INCREMENTAL"
LOG_BASED = "LOG_BASED"
Sources: src/flext_tap_oracle/constants.py:46-56
The system also defines default behaviors for these methods in rules.json:
- Default Method:
FULL_TABLE. - Incremental Support: Requires a replication key (datetime, timestamp, or number).
- Discovery:
auto_discover_tablesis enabled by default, butinclude_viewsis disabled.
Sources: src/flext_tap_oracle/rules.json:145-155, src/flext_tap_oracle/rules.json:166-175
Environmental and Test Constants
The project distinguishes between environment-specific rules and provides a robust set of constants for unit and integration testing.
Environment Profiles
The rules.json defines how constants shift based on the deployment environment:
- Development: Enables SQL logging and uses smaller batch sizes.
- Production: Disables SQL logging, optimizes batch sizes, and enforces strict connection validation with required SSL.
Sources: src/flext_tap_oracle/rules.json:280-305
Test-Specific Constants
Test constants are managed in the tests/constants.py file, inheriting from both production and test-base constants. They provide fixed values for shared containers and environment variable keys.
| Namespace | Constant | Value |
|---|---|---|
| Container | SHARED_CONTAINER_PORT_PREFIX | "1521" |
| Container | SHARED_CONTAINER_USER | "flext_test" |
| Environment | ORACLE_HOST_ENV | "ORACLE_HOST" |
| Timeouts | SOCKET_TIMEOUT_SECONDS | 0.5 |
Sources: tests/constants.py:25-60
Data Type Mappings
The tap maintains a constant mapping between Oracle internal data types and Singer JSON schema types. This ensures consistent data representation during the extraction process.
The diagram illustrates the transformation of Oracle database types into Singer-compliant JSON types.
Sources: src/flext_tap_oracle/rules.json:208-230
| Oracle Type | Singer Type | Rules / Format |
|---|---|---|
VARCHAR2, CLOB, RAW | string | UTF-8 encoding |
NUMBER, BINARY_FLOAT | number | Precision preserved |
DATE, TIMESTAMP | string | YYYY-MM-DDTHH:MI:SS.FFFTZ |
JSON | t.JsonValue | Native JSON parsing |
Sources: src/flext_tap_oracle/rules.json:208-230
Conclusion
Constants and defaults in flext-tap-oracle are strictly organized to support the FLEXT 1.0.0 architecture. By centralizing operational limits, performance tunables, and type mappings into constants.py and rules.json, the project ensures that the Oracle tap remains predictable and configurable across different deployment environments and replication scenarios.