FEAT: Add spatial type support (geography, geometry, hierarchyid) by dlevy-msft-sql · Pull Request #423 · microsoft/mssql-python
Add SQL_SS_UDT (-151) handling for SQL Server spatial types, enabling geography, geometry, and hierarchyid columns to be fetched as raw bytes. C++ changes (ddbc_bindings.cpp): - SQLGetData_wrap: SQL_SS_UDT falls through to SQL_BINARY - SQLBindColumns: SQL_SS_UDT falls through to SQL_BINARY - FetchBatchData: SQL_SS_UDT falls through to ProcessBinary - calculateRowSize: SQL_SS_UDT with LOB-size fallback for 0/SQL_NO_TOTAL - FetchMany_wrap/FetchAll_wrap: SQL_SS_UDT added to LOB detection Python changes: - constants.py: SQL_SS_UDT = -151 in ConstantsDDBC enum + get_valid_types() - cursor.py: SQL_SS_UDT -> SQL_C_BINARY in _get_c_type_for_sql_type, SQL_SS_UDT -> bytes in _map_data_type Tests: 37 tests covering all three spatial types across fetch paths (fetchone, fetchmany, fetchall, executemany), NULL handling, mixed-column queries, output converters, description metadata, spatial methods, error handling, and binary output consistency.