Problem
The query CLI has helper logic mixed into the main command file, similar to what quality CLI had before refactoring.
Context
During v0.8.2 PR review, we extracted quality CLI helpers into src/mapper/cli/_quality_helpers.py for better code organization. The query CLI should follow the same pattern.
Proposed Solution
Extract query execution logic from src/mapper/cli/queries.py into src/mapper/cli/_query_helpers.py.
Files to create:
src/mapper/cli/_query_helpers.py - Helper functions for query execution
Current structure in queries.py - 60+ lines of connection, execution, formatting logic embedded in command
Target structure: Extract to helper function that handles connection, execution, error handling
Benefits
- Consistent pattern across query and quality CLIs
- Easier to test (helper functions can be unit tested in isolation)
- Cleaner separation of concerns (CLI command vs execution logic)
- Reduces code duplication if we add more query-related commands
Target Version
v0.8.3 or later (code quality improvement, not blocking)
Related
Problem
The query CLI has helper logic mixed into the main command file, similar to what quality CLI had before refactoring.
Context
During v0.8.2 PR review, we extracted quality CLI helpers into
src/mapper/cli/_quality_helpers.pyfor better code organization. The query CLI should follow the same pattern.Proposed Solution
Extract query execution logic from
src/mapper/cli/queries.pyintosrc/mapper/cli/_query_helpers.py.Files to create:
src/mapper/cli/_query_helpers.py- Helper functions for query executionCurrent structure in queries.py - 60+ lines of connection, execution, formatting logic embedded in command
Target structure: Extract to helper function that handles connection, execution, error handling
Benefits
Target Version
v0.8.3 or later (code quality improvement, not blocking)
Related