Skip to content

Conversation

@ianhelle
Copy link
Contributor

@ianhelle ianhelle commented Dec 9, 2025

This pull request removes the AI agents and retrieval-augmented generation (RAG) integration code from the msticpy/aiagents package, and updates the SQL-to-KQL translation logic to support newer versions of mo-sql-parsing (version 11+). It also modernizes type annotations and improves the handling of SQL parsing edge cases. The most important changes are grouped below.

AI Agents and RAG Integration Removal:

  • Deleted the entire contents of msticpy/aiagents/config_utils.py, msticpy/aiagents/mp_docs_rag_magic.py, and msticpy/aiagents/rag_agents.py, effectively removing all AI agent and RAG magic functionality from the codebase. [1] [2] [3]
  • Removed the module docstring in msticpy/aiagents/__init__.py, signaling the deprecation of AI agent-related modules.

SQL-to-KQL Translation Modernization:

  • Updated the dependency in conda/conda-reqs-pip.txt to require mo-sql-parsing version 11 or higher, ensuring compatibility with the latest features and syntax.
  • Refactored msticpy/data/sql_to_kql.py to use modern Python type annotations (PEP 604) and improved function signatures for readability and type safety. Also, clarified documentation to indicate support for mo-sql-parsing version 11+. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • Improved parsing logic in sql_to_kql.py to better handle union operations and new column formats, and added a note about PIVOT operations requiring additional handling. [1] [2] [3]

Minor Code Quality Improvements:

  • Removed unnecessary # noqa: MC0001 comments and cleaned up function signatures in several files for clarity and maintainability. [1] [2] [3]

References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request modernizes the codebase for Python 3.13 compatibility by removing the AI agents/RAG integration functionality and updating the SQL-to-KQL translation module to support mo-sql-parsing version 11+. The changes include dependency updates, modern type annotations using PEP 604 syntax, and enhanced test coverage.

Key changes:

  • Complete removal of the msticpy/aiagents package and its dependencies
  • Updated mo-sql-parsing requirement from version 8-9 to version 11-12
  • Modernized type annotations throughout sql_to_kql.py using PEP 604 union syntax (| instead of Union)
  • Enhanced SQL-to-KQL parser to handle new mo-sql-parsing v11+ formats, including all_columns for SELECT *, union_all handling, and improved COUNT(DISTINCT) support
  • Added 25+ comprehensive test cases covering edge cases and various SQL operations

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
msticpy/aiagents/__init__.py Removed module docstring as part of aiagents deprecation
msticpy/aiagents/config_utils.py Deleted entire file containing Autogen configuration utilities
msticpy/aiagents/mp_docs_rag_magic.py Deleted entire file containing IPython magic commands for RAG
msticpy/aiagents/rag_agents.py Deleted entire file containing RAG agent implementation
tests/aiagents/test_rag_agents.py Deleted test file for removed RAG functionality
setup.py Updated mo-sql-parsing version constraint to 11-12, removed aiagents extra, cleaned up file open calls
requirements-all.txt Updated mo-sql-parsing version and removed autogen-agentchat dependency
conda/conda-reqs-pip.txt Updated mo-sql-parsing version and removed autogen-agentchat dependency
msticpy/data/sql_to_kql.py Modernized type annotations, enhanced parser for v11+ format support, improved union_all/COUNT(DISTINCT) handling, added all_columns support for SELECT *
msticpy/data/core/query_source.py Removed unnecessary noqa comment from function signature
msticpy/data/drivers/mordor_driver.py Removed unnecessary noqa comment from function signature
tests/data/test_sql_to_kql.py Added raw string prefix for regex test, added 25+ comprehensive test cases covering SQL operators, joins, aggregations, and edge cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@ryan-detect-dot-dev ryan-detect-dot-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ianhelle ianhelle merged commit d235883 into main Dec 16, 2025
12 checks passed
@ianhelle ianhelle deleted the ianhelle/update_mo_sql_parsing-2025-12-08 branch December 16, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants