CLI Interface
Relevant source files
The following files were used as context for generating this wiki page:
The CLI Interface for flext-target-oracle-wms serves as the primary entry point for executing the Singer-compatible target. It facilitates the ingestion of data from standard input (stdin), processes configuration settings from JSON files, and orchestrates the target runtime lifecycle, including setup, data processing, and cleanup.
Sources: src/flext_target_oracle_wms/cli.py:12-20, pyproject.toml:68-70
Architecture and Components
The CLI is structured around the FlextTargetOracleWmsCli class, which encapsulates the logic for configuration management and pipeline execution. It leverages the FlextTargetOracleWmsUtilitiesClient.Target to perform the actual data transformation and loading tasks.
CLI Execution Flow
The following diagram illustrates the sequence of operations when the CLI is invoked:
Command Line Usage
The package exposes two primary command-line scripts as defined in the project configuration:
flext-target-oracle-wmstarget-oracle-wms
Sources: pyproject.toml:68-70, src/flext_target_oracle_wms/__init__.py:63
Arguments and Options
| Argument | Description | Required | Default |
|---|---|---|---|
--config | Path to the JSON configuration file containing WMS credentials and settings. | No | Internal defaults |
Sources: src/flext_target_oracle_wms/cli.py:91-95, tests/unit/test_oracle_wms_cli.py:92-98
Configuration Management
The CLI handles configuration by either loading a JSON file provided via the --config argument or falling back to a set of default (invalid) credentials for safety. It utilizes Pydantic for validation of the WmsTargetConfig model.
Configuration Structure
A valid configuration file must include the wms_auth object:
{
"wms_auth": {
"base_url": "https://test.wms.example.com",
"username": "user",
"password": "pass"
}
}
Sources: tests/unit/test_oracle_wms_cli.py:34-42, src/flext_target_oracle_wms/cli.py:65-83
Message Processing Logic
The CLI reads messages from sys.stdin. These messages must conform to the Singer protocol, which includes SCHEMA, RECORD, and STATE message types.
Technical Specifications
| Component | Specification |
|---|---|
| CLI Class | FlextTargetOracleWmsCli |
| Version | 0.9.0 (CLI specific) |
| Input Source | sys.stdin |
| Output Target | Oracle WMS SaaS |
| Dependencies | flext-core, flext-meltano, pydantic |
Sources: src/flext_target_oracle_wms/cli.py:15-20, pyproject.toml:23-32, tests/unit/test_quality.py:92-94
Error Handling
The CLI implements a robust error handling strategy using the Result pattern. If any part of the pipeline—configuration loading, setup, or message processing—fails, the CLI captures the error and raises a RuntimeError with a descriptive message to terminate the process.
- File Not Found: Raised if the
--configpath is invalid. - Validation Error: Raised if the JSON input does not match the expected Singer or Configuration schema.
- Execution Failure: Raised if the Target cleanup or setup returns a failure result.
Sources: src/flext_target_oracle_wms/cli.py:58-63, src/flext_target_oracle_wms/cli.py:101-104, tests/unit/test_oracle_wms_cli.py:54-56
Summary
The CLI Interface provides a standardized, Singer-compliant wrapper for the Oracle WMS target. By managing the lifecycle of the Target runtime and providing clear configuration paths, it enables seamless integration into ETL pipelines and the Meltano ecosystem. Significant emphasis is placed on validation and result-based error handling to ensure data integrity during the loading process.
Sources: src/flext_target_oracle_wms/cli.py:12-20, src/flext_target_oracle_wms/_utilities/client.py:120-125