How to run a SELECT WHERE column IN (...) query?

You need to dump the string UUID first to a binary like this:

{:ok, bin} = Ecto.UUID.load(room_id)

Now you can use the binary UUID directly in your query like this:

where: chat_rooms.id_ref == ^bin

Note that if you use an Ecto schema, you don’t need to do all this manual casting and dumping.