rails-sqlserver / tiny_tds

TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
Other
607 stars 189 forks source link

Support JSON data type #562

Open HoneyryderChuck opened 1 week ago

HoneyryderChuck commented 1 week ago

MS SQL Server seems to have support for JSON data types. Would it be possible to support it via tinyTDS? Reported in sequel as well

andyundso commented 1 week ago

could be possible, but it is not straight-forward.

  1. freetds needs to support it. we rely on dbcoltype which tells us the column type in MSSQL and we can select the proper Ruby type to convert the value into. usually, there is a constant defined here in the freetds docs that would describe it, but I do not see anything here that would indicate support for this new JSON type.
  2. in tiny_tds, we will have to map it out. I assume you would expect tiny_tds to return a hash, right?
  3. This feature seems to be in preview and for Azure only, which makes it hard for us to develop and test. I would suggest we wait until the feature is no longer considered a preview (API is stable). maybe there will be a SQL Server 2025 release where this JSON data type will be included, which would make it much easier for us.
HoneyryderChuck commented 1 week ago

thx for the answer! It makes sense to wait 👍