bodhilogic

bodhilogic

I’m trying to create an API that interfaces to a MS SQL database. My mix deps.get reports no errors or problems, but when I mix run --no-halt, I get a series of warnings about SQL and migrations (my app is a read-only app for an existing MS SQL database so I have no migrations).

How do I deal with this problem?

==> ecto
Compiling 70 files (.ex)
warning: redefining module Ecto.Adapters.MySQL (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapters.MySQL.beam)
  lib/ecto/adapters/mysql.ex:1

warning: redefining module Ecto.Adapters.SQL.Stream (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapters.SQL.Stream.beam)
  lib/ecto/adapters/sql/stream.ex:1

warning: redefining module Ecto.Adapter.Migration (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapter.Migration.beam)
  lib/ecto/adapter/migration.ex:1

warning: redefining module Ecto.Adapters.SQL.Sandbox (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapters.SQL.Sandbox.beam)
  lib/ecto/adapters/sql/sandbox.ex:1

warning: redefining module Ecto.Migration.Runner (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Migration.Runner.beam)
  lib/ecto/migration/runner.ex:1

warning: redefining module Ecto.Adapters.SQL.Sandbox.Connection (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapters.SQL.Sandbox.Connection.beam)
  lib/ecto/adapters/sql/sandbox.ex:296

warning: redefining module Ecto.Migration.SchemaMigration (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Migration.SchemaMigration.beam)
  lib/ecto/migration/schema_migration.ex:1


== Compilation error in file lib/ecto/adapters/mysql.ex ==
** (FunctionClauseError) no function clause matching in Keyword.fetch!/2    
    
    The following arguments were given to Keyword.fetch!/2:
    
        # 1
        :mariaex
    
        # 2
        :driver
    
    Attempted function clauses (showing 1 out of 1):
    
        def fetch!(keywords, key) when is_list(keywords) and is_atom(key)
    
    (elixir) lib/keyword.ex:390: Keyword.fetch!/2
    lib/ecto/adapters/mysql.ex:118: (module)
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6

Here is my mix deps declaration:

  defp deps do
    [
      {:jason, "~> 1.0"},
      {:mssql_ecto, "~> 1.2.0"},
      {:mssqlex, "~> 1.1.0"},
      {:poison, "~> 3.0"},
      {:plug, "~> 1.8"},
      {:cowboy, "~> 2.7"},
    ]
  end

First 7 of 7 Posts Switch mode

matreyes

matreyes

Not sure why it’s calling to MYSQL (not mssql), maybe you should check the Repo configuration for the adapter. It should be

config :my_app, MyApp.Repo,
adapter: MssqlEcto

(it seems to be MySql)

FYI, I had a similar use case (read only) and I’ve avoided using ecto (another dependency), and I just used raw sql queries from mssqlex. It was way simpler for this case. Maybe it’s a good idea also for you?

bodhilogic

bodhilogic OP

My Repo is like this, but your idea would work, I’ll think about doing that.

defmodule TwApi.Repo do
  use Ecto.Repo,
    otp_app: :tw_api,
    adapter: Ecto.Adapters.MssqlEcto

    ...
    ...
end
matreyes

matreyes

But it’s still calling to the mysql adapter… have you checked your config files?

bodhilogic

bodhilogic OP

I’ve been checking EVERY file - not a MySQL anywhere!?!?
It seems to be something that elixir is adding in ‘after the fact’…

matreyes

matreyes

Maybe as default, when no config was set… :man_shrugging:

NobbZ

NobbZ

Please check your mix.lock which version of ecto got pulled in. Perhaps we can use that information to narrow things down.

bodhilogic

bodhilogic OP

"ecto": {:hex, :ecto, "2.2.12", "ce7f619c1451daad0f59e8f01fd8e2584226171dc273e3346444446a13d93943", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement