How SQL Server capability derivation works
mainSoda Core uses a three-step process to determine if specific SQL features (like APPROX_PERCENTILE_DISC) are supported by your SQL Server instance. This ensures that the correct SQL syntax is generated based on your specific engine version and edition.
- Detection: When a connection is opened via
SqlServerDataSourceConnection, Soda Core eagerly probes the server for itsserver_major_version(viapyodbc.SQL_DBMS_VER) and itsengine_edition(viaSELECT CAST(SERVERPROPERTY('EngineEdition') AS INT)). - Sync: The
SqlServerDataSourceImplsynchronizes these raw facts from the connection onto theSqlServerSqlDialectinstance. - Derivation: The
SqlServerSqlDialectuses these facts to calculate support. For example, it checks if the version is $\ge 16$ (SQL Server 2022) or if the engine edition matches Azure SQL Database (5) or Managed Instance (8).
Note on Offline/Snapshot Replay: If no server facts are available (e.g., during offline rendering or snapshot replay), Soda Core assumes the newest engine version and enables capabilities by default.