CLI Interface
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The CLI Interface for flext-dbt-ldif serves as the primary entry point for executing LDIF data transformations and dbt model generation from a command-line environment. It provides a structured way to interact with the underlying service orchestration layer, which handles parsing, validation, and dbt workflow execution for LDAP Data Interchange Format (LDIF) files.
The interface is built to be compliant with the flext-core and flext-cli standards, ensuring consistent behavior across the FLEXT ecosystem. It allows users to trigger complete workflows that bridge the gap between raw LDIF data and business-ready dbt models.
Sources: pyproject.toml:53-54, README.md:10-15, src/flext_dbt_ldif/services/service.py:79-130
Architecture and Entry Points
The CLI is exposed as a managed script defined in the project configuration. The execution flow typically starts at a central entry point which then delegates the actual business logic to specialized service classes.
Command Registration
The CLI entry point is registered in the Python environment using the flext-fixed-script handle.
| Component | Identifier | Description |
|---|---|---|
| Script Name | flext-fixed-script | The command used to invoke the tool from the terminal. |
| Main Entry | flext_dbt_ldif.cli:main | The Python function acting as the root of the CLI application. |
| Service Class | FlextDbtLdifCliService.CliService | The class responsible for handling CLI-specific logic and user interaction. |
Sources: pyproject.toml:53-54, tests/unit/test_cli.py:12-16
Execution Flow
The following diagram illustrates how a CLI request moves from the user through the service layer to the dbt orchestration logic.
Note: The CLI utilizes a Service Mixin to orchestrate parsing via the Client and model generation via the UnifiedService.
Sources: src/flext_dbt_ldif/services/service.py:27-46, tests/unit/test_cli.py:16
Workflow Integration
The CLI facilitates the run_complete_workflow operation, which is the primary integration point for end-to-end processing. This workflow covers the entire lifecycle of LDIF data within the dbt environment.
Workflow Stages
- Parsing: Converts the LDIF file into a structured internal representation.
- Validation: Assesses the data quality and assigns a quality score.
- Model Generation: Automatically creates staging and analytics dbt models based on the detected LDIF schema.
- Transformation: Executes dbt transformations against the generated models.
Configuration and Standards
The CLI interface adheres to strict engineering principles defined in the AGENTS.md and pyproject.toml files, ensuring that it remains a reliable tool for automated pipelines.
Banned APIs and Standardized Tooling
The project strictly forbids direct usage of common CLI libraries in favor of the flext-cli wrapper to ensure unified output formatting and error handling.
- Argument Parsing: Use
cli.register_result_commandinstead ofargparse. - User Prompts: Use
cli.promptorcli.confirminstead ofprompt_toolkit. - Progress Bars: Use
cli.display_progressinstead oftqdm. - Table Formatting: Use
cli.format_tableinstead oftabulate.
Sources: pyproject.toml:346-383, AGENTS.md:15-30
Conclusion
The CLI Interface provides a robust and standardized mechanism for interacting with the flext-dbt-ldif library. By wrapping complex operations like pattern analysis, model generation, and dbt execution into simple command structures, it enables efficient management of LDAP data within modern data stacks. The design ensures that all operations are validated, logged, and compliant with the broader FLEXT ecosystem standards.