mbklein

mbklein

Using Ecto.Query in a RemoteExecutionCell

I’ve got Livebook (using the livebook:edge Docker container) set up and properly executing code on a remote node (though I have some configuration questions that I’ll address in a different topic). The only major problem I’m having comes when I try to use Ecto.Query.

If I try to import Ecto.Query, I get an error that says error: module Ecto.Query is not loaded and could not be found.

If I try to use Ecto.Query.from(...) directly without importing it, I get

** (ErlangError) Erlang error: {:exception, :undef, [{Ecto.Query, :from, [Meadow.Data.Schemas.Work, [limit: 1]], []}, {:elixir_eval, :__FILE__, 1, [file: ~c"#cell:gsynocyaqcunidcyirskfy2tyhh2wirn", line: 5]}, {:elixir, :"-eval_external_handler/1-fun-2-", 4, [file: ~c"src/elixir.erl", line: 376]}, {:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 750]}, {:erl_eval, :expr_list, 7, [file: ~c"erl_eval.erl", line: 1026]}, {:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 456]}]}
    (kernel 9.0.2) erpc.erl:702: :erpc.call/5
    #cell:gsynocyaqcunidcyirskfy2tyhh2wirn:4: (file)

If I try to require it before using it that way, I get the ...is not loaded and could not be found error again.

Oddly, remote autocomplete finds it just fine:

Other macros (like Logger.warning/2) seem to work just fine, so it doesn’t seem to be a macro issue.

Can anyone provide any guidance or answers on this?

Marked As Solved

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Hi @mbklein as a basic question, did you Mix.install ecto as a dependency? Can you show the failing livebook?

Also Liked

mbklein

mbklein

Yup, adding ecto as a dependency of the local notebook got it working.

It’s so easy to lose track of what’s building which AST and passing it off to where in an RPC situation, but it makes sense that macros need to be evaluated before the remote call is made.

Last Post!

mbklein

mbklein

Yup, adding ecto as a dependency of the local notebook got it working.

It’s so easy to lose track of what’s building which AST and passing it off to where in an RPC situation, but it makes sense that macros need to be evaluated before the remote call is made.

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New

Other popular topics Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54996 245
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31525 112
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44167 214
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement