Debugging & Troubleshooting
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Debugging and troubleshooting within the flext-target-oracle project involves a multi-layered approach encompassing structured logging, a specialized exception hierarchy, health monitoring, and comprehensive test suites. The system is designed to provide granular visibility into the data loading process, from initial configuration validation to final database commits.
The project utilizes Railway-Oriented Programming (ROP) via the r result pattern, ensuring that errors are handled as first-class citizens rather than side effects. This approach, combined with production-grade monitoring and automated test environments, allows developers to isolate issues across Oracle connectivity, Singer message processing, and DDL/DML execution.
Sources: examples/README.md:38-42, CONTRIBUTING.md:162-166, examples/03_production_setup.py:126-130
Exception Management and Error Metadata
The project implements a structured exception hierarchy where Oracle-specific errors inherit from the flext-core foundation. This ensures consistency across the FLEXT ecosystem while providing specific context for database-related failures.
Structured Error Metadata
Errors are enriched with FlextTargetOracleErrorMetadata, which includes canonical error codes and correlation IDs for cross-service tracking.
| Field | Description |
|---|---|
code | Canonical error code (e.g., CONNECTION_ERROR, VALIDATION_ERROR). |
context | Structured mapping containing specific details like stream_name, user, or dsn. |
correlation_id | Identifier used for tracing errors across service boundaries. |
Sources: src/flext_target_oracle/_utilities/errors.py:22-38
Exception Classes
The following table describes the primary exception classes used to categorize failures:
| Exception Class | Purpose |
|---|---|
OracleConnectionError | Failures during database handshake, including DSN and user context. |
AuthenticationError | Permission or credential failures, including wallet location if applicable. |
SchemaError | Validation failures related to Singer schemas, including schema hashes. |
ProcessingError | Runtime failures during record insertion, including record counts and operation types. |
Sources: src/flext_target_oracle/_utilities/errors.py:65-155
Observability and Health Monitoring
For production environments, the project provides a ProductionTargetManager that includes built-in health checks and real-time metric collection.
Health Check Workflow
The health check mechanism evaluates the target's initialization state and active database connectivity.
The health status includes a timestamp, status string (healthy, degraded, or unhealthy), and specific check results.
Sources: examples/03_production_setup.py:126-193
Debugging Environment and Setup
Developers can enable verbose debugging by setting specific environment variables to increase log granularity.
Debug Mode Configuration
Setting FLEXT_DEBUG=true enables detailed internal state logging, while FLEXT_LOG_LEVEL=DEBUG captures fine-grained Singer message transitions.
export FLEXT_DEBUG=true
export FLEXT_LOG_LEVEL=DEBUG
Sources: CONTRIBUTING.md:189-192
Common Development Issues
- Import Errors: Usually resolved by ensuring all
flext-*dependencies frompyproject.tomlare installed viapoetry install. - Oracle Connection: Typically requires verifying the Docker container status via
make oracle-logs. - Type Errors: These are caught during development using
mypyand themake type-checkcommand.
Sources: CONTRIBUTING.md:194-197, pyproject.toml:23-35
Troubleshooting via Automated Testing
The test suite is the primary tool for isolating failures in DDL (Data Definition Language) and DML (Data Manipulation Language) operations.
Test Categories and Isolation
The project categorizes tests to isolate environment-specific issues:
Sources: tests/README.md:46-60
Database Lifecycle Management
If integration tests fail, developers can use manual container management commands to inspect the state:
make oracle-shell: Opens a SQL*Plus shell to inspect theFLEXT_TESTschema.make oracle-logs: Displays the Oracle XE container logs to check for database-level errors (e.g., tablespace exhaustion)../scripts/run_tests.sh --keep-db: Prevents the container from stopping after tests, allowing for manual post-mortem inspection.
Sources: tests/README.md:34-44, tests/README.md:73-77
Summary
Troubleshooting flext-target-oracle requires a systematic review of configuration validation, Singer message integrity, and Oracle connectivity. By leveraging the structured FlextTargetOracleExceptions and production HealthStatus metrics, developers can quickly differentiate between environmental connectivity issues, schema validation errors, and runtime processing failures. The combination of ROP error handling and a containerized testing strategy provides the necessary tools for maintaining high-reliability data pipelines.
Sources: examples/03_production_setup.py:355-385, CONTRIBUTING.md:162-166