Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for uniqueidentifier / UUIDs #20

Open
timbuchwaldt opened this issue Jul 28, 2017 · 5 comments
Open

Support for uniqueidentifier / UUIDs #20

timbuchwaldt opened this issue Jul 28, 2017 · 5 comments

Comments

@timbuchwaldt
Copy link

timbuchwaldt commented Jul 28, 2017

I would love to see support for the native MS-SQL uniqueidentifier datatype.

Expected Behavior

Mapping :binary_id to uniqueidentifier

Current Behavior

Currently data returned with a uniqueidentifier datatype raises an error:

** (Mssqlex.Error) Column type not supported | ODBC_CODE  | SQL_SERVER_CODE 0

Possible Solution

Something like
https://github.com/elixir-ecto/postgrex/blob/b1c0d7e4fd517b56fbd3bcdb7f2ee21e107c2665/lib/postgrex/extensions/uuid.ex##

Context

Using UUID is pretty standard behaviour I would assume.

@jbachhardie
Copy link

Unfortunately supporting additional column types is quite challenging since it would require changes to the driver being used, either in the form of updates to Erlang's ODBC driver or the development of a new driver for Elixir/Erlang.

I heard @toddharding might be working on patching Erlang ODBC in this way but there's no ETA since it's work beyond what we can justify doing on paid company time. Do contact him if you know C and/or the OTP codebase and want to help get it done.

@cdesch
Copy link
Contributor

cdesch commented Jan 8, 2018

The uniqueidentifer is a bit of a show stopper. @toddharding did the Erlang ODBC ever get this update? I don't see anything 2.12.1 release notes. I'm not sure how I would go about patching this in the ODBC either.

reference issue #31

@shdblowers
Copy link
Collaborator

I had a go at doing a similar issue to this myself a few months ago, around adding a datetimeoffset column findmypast-oss/mssqlex#7.

That code base was just far too complex for me to understand, reason about and then modify it correctly. It was also very difficult to get it set-up correctly on my machine.

I ended up losing motivating and abandoning it.

Anyone who has the motivation to give it a go, there are a few useful resources in that issue and the bug board it links to has some helpful people on it.

@cdesch
Copy link
Contributor

cdesch commented Jan 9, 2018

Not having some of these native data types fields supported really hurts any elixir/erlang + MS SQL Server development or applications. I would hope that some of the folks from Microsoft would help out a little for their product. Since I can't get it to work with MS SQL Server, I'll migrate the data to PostgreSQL and work with it from there. As a Long shot, maybe some of the folks at MSSQL-docker can refer us to someone that can help @LuisBosquez

@noizu
Copy link

noizu commented Mar 26, 2020

@cdesch It's easy enough to patch the odbc to handle guid types (https://github.com/noizu/otp) by basically treating them as another char type column. For example with the above quick and dirty fork I can work with MSSQL if changing binary_id columns to :string or modifying the ecto.uuid.load method to accept the sql_guid string in addition to raw binary input format.

I need this functionality as well so I'll be trying to get something accepted upstream but it while take a bit of time to line up all the details.

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

No branches or pull requests

5 participants