-
Notifications
You must be signed in to change notification settings - Fork 17
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 UUID #56
Comments
As a workaround this seems to work |
Raw UUID is binary and encoding it as JSON string fails. See livebook-dev/kino#192. |
And for the mirrored workaround where you want to use the output of
Because the following will not work:
|
One more time I stumbled on on this and created this workaround: # Naively maps UUIDs in rows values to string
# depends on https://hexdocs.pm/elixir_uuid/
update_in(postgrex_result, [Access.key!(:rows), Access.all(), Access.all()], fn
<<_uuid::128>> = value -> UUID.binary_to_string!(value)
value -> value
end) |
I just ran into this as well, and I found the behavior quite confusing. Since its very common for UUIDs to be return in queries, might a simple fix here be to add a suggestion to the error message? e.g.
What do you think @jonatanklosko |
I think improving the error message can be a good call. @jonatanklosko, do we know the smart cell that triggered the error in Livebook? |
I can reproduce this using a |
@josevalim it's not specific to smart cell, the query returns |
@jonatanklosko it is either a better error message OR we implement this issue: michalmuskala/jason#12. But that means the UUID above would be rendered as |
I've just realised it's not really about UUID, the issue is just that Kino.DataTable doesn't inspect non-utf8 binaries, which we can easily do. See livebook-dev/kino#362. |
When trying to query a table with uuid primary key with postgrex (
SELECT * FROM table
) I get this error:The text was updated successfully, but these errors were encountered: