After finally setting up my repo Cross DB Ecto config failing trying to run a query gives me this:
iex(1)> import Ecto.Query
Ecto.Query
iex(2)> Drupex.DrupalRepo.query(from "watchdog", select: [:wid]);
** (Protocol.UndefinedError) protocol String.Chars not implemented for #Ecto.Query<from w in "watchdog", select: [:wid]>. This protocol is implemented for: Atom, BitString, Date, DateTime, Decimal, Ecto.Date, Ecto.DateTime, Ecto.Time, Float, Integer, List, Mariaex.Query, NaiveDateTime, Postgrex.Copy, Postgrex.Query, Postgrex.Stream, Time, URI, Version, Version.Requirement
(elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
(elixir) lib/string/chars.ex:22: String.Chars.to_string/1
(ecto) lib/ecto/adapters/sql.ex:613: Ecto.Adapters.SQL.log/4
(db_connection) lib/db_connection.ex:1186: DBConnection.log/6
(db_connection) lib/db_connection.ex:643: DBConnection.execute/4
(ecto) lib/ecto/adapters/sql.ex:256: Ecto.Adapters.SQL.sql_call/6
I tried to Google on how to get the error handler to show arguments but found nothing so I do not know what the error is -- is my query invalid, does it have a problem connecting to the MySQL server etc.
Edit: I figured it out, it's Drupex.DrupalRepo.all
. I figured it out by adding IO.inspect
calls into lib/ecto/adapters/sql.ex
but this is a very dirty hack, surely there are better ways.