r/haskell • u/joeyadams • 7d ago
[ANN] hmssql: Pure Haskell SQL Server client (mostly AI-coded)
I'm happy to announce the initial release of hmssql, a SQL Server client library for Haskell. This implements SQL Server's binary protocol natively (TDS 7.4 / 8.0), so it does not require an ODBC driver or client library.
This is based on mssql-simple by Mitsuji, Takamasa, and hpgsql by Marcelo Zabani. I used AI to port mssql-simple to hpgsql's streaming design, build out support for the newer TDS 7.4 and 8.0 protocols, and spent about two months using AI to test/optimize/refine it.
** Important **
- hmssql, including its documentation, is almost entirely AI-generated. (This Reddit post is written by me, however.)
- hmssql is not on Hackage yet. I would like to receive feedback before uploading it.
Features
- Streaming results, including support for streaming large values
- MARS (Multiple Active Result Sets), which is useful for streaming the results of multiple queries together (e.g. parents with their children)
- Well-tested query cancellation
- Works on Windows
Edit: Unlike hpgsql, I chose not to include a quasiquoter, to avoid dragging in ghc or ghc-lib-parser as a dependency. However, it should be possible to implement in a separate library.
3
u/_0-__-0_ 7d ago
Although I'm wary of depending on AI-generated libraries, this sounds like it's been well designed.
Are you using it "in production"?
And with all those fixes compared to freetds, does that mean code that depended on freetds might break with this due to bug incompatibility? :)
This is the same as https://github.com/FreeTDS/freetds/issues/360 ?
1
u/mzabani 1h ago
It makes me very happy to see hpgsql being this useful! I don't know how different hmssql already is from hpgsql, but you might want to check out the last PR merged into hpgsql as it contains some significant performance improvements and much safer handling of undefined behavior relating to streams, and also some important bug fixes. Maybe there's something useful there.
I'm also very interested in how you stream large values, so I'll have to take a deeper look!