Skip to content

feat(DATAGO-122877): Implement MSSQL tool with pyodbc driver#90

Open
Hugo-Pare wants to merge 7 commits intomainfrom
hugo/mssql-tool
Open

feat(DATAGO-122877): Implement MSSQL tool with pyodbc driver#90
Hugo-Pare wants to merge 7 commits intomainfrom
hugo/mssql-tool

Conversation

@Hugo-Pare
Copy link
Collaborator

@Hugo-Pare Hugo-Pare commented Jan 23, 2026

What is the purpose of this change?

Adds Microsoft SQL Server (MSSQL) support to the sam-sql-database-tool plugin, expanding database compatibility beyond PostgreSQL, MySQL, and MariaDB.

How was this change implemented?

  • pyproject.toml: Added pyodbc dependency for MSSQL connectivity and testcontainers[mssql] for testing
  • database_service.py: Added MSSQL-specific row count query using sys.tables/sys.partitions and extended string type detection to include NVARCHAR, NCHAR, NTEXT
  • conftest.py: Added MSSQL test container configuration with SqlServerContainer and pyodbc connection URL
  • test_data.py: Set autoincrement=False on all primary keys to allow explicit ID inserts (MSSQL IDENTITY column restriction)
  • test_sql_tool.py: Cast rating to Float in aggregation test to handle MSSQL integer division behavior
  • test_config_features.py: Added dialect-specific ALTER TABLE syntax (MSSQL omits COLUMN keyword in ADD)
  • README.md: Updated documentation with MSSQL connection string example

Key Design Decisions

  • Chose pyodbc over pymssql as it's more widely supported and Microsoft-recommended, though it requires an ODBC Driver to be installed on the host system
  • Used autoincrement=False in test tables rather than modifying INSERT statements to keep test queries database-agnostic

How was this change tested?

  • Manual testing: Connected to local MSSQL Docker container and verified queries execute correctly
  • Unit tests: Existing unit tests pass
  • Integration tests: All integration tests pass across PostgreSQL, MySQL, MariaDB, and MSSQL (223 tests total)
  • Known limitations: Requires an ODBC Driver for SQL Server installed on the host system

Is there anything the reviewers should focus on/be aware of?

  • The MSSQL connection string requires TrustServerCertificate=yes for self-signed certificates (common in dev/test environments)
  • Users will need to install the ODBC Driver separately - this is a system-level dependency that cannot be bundled with the Python package

@Hugo-Pare Hugo-Pare changed the title feat(DATAGO-122245): Implement MSSQL tool with pyodbc driver feat(DATAGO-123946): Implement MSSQL tool with pyodbc driver Feb 3, 2026
@Hugo-Pare Hugo-Pare changed the title feat(DATAGO-123946): Implement MSSQL tool with pyodbc driver feat(DATAGO-122877): Implement MSSQL tool with pyodbc driver Feb 3, 2026
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

✅ SonarQube Quality Gate - All Passed

Plugin Quality Gate Status Analysis
sam-sql-database-tool ✅ Passed See analysis details on SonarQube

Quality gate checks are run for each modified plugin. Click the SonarQube links above for detailed analysis.

Copy link

@m9p909 m9p909 left a comment

Choose a reason for hiding this comment

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

  • add mssql row count
  • add integration tests
  • add documentation for MSSQL
  • Add mssql specific text types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants