edoar94
Erlang QLC Joins - trying merge two tables but result data is duplicated
Hi, someone have some Erlang qlc join examples? i’m trying merge two tables but result data is duplicated. i write this qlc:
disk_partitions() ->
mnesia:transaction(
fun() ->
qlc:eval(
qlc:q([
{D0, D1, D2, D3, P, D5, D6} ||
{D0, D1, D2, D3, _D4, D5, D6} <- mnesia:table(disk),
P = {_P0, P1, _P2, _P3, _P4, _P5, _P6, _P7} <- mnesia:table(partition),
D1 =:= re:replace(P1, "[0-9]+", "", [{return, binary}])
])
)
end
).
and returned this:
iex(43)> :join_queries.disk_partitions
{:atomic,
[
{:disk, "/dev/sdb", "101 GT", "dos",
{:partition, "/dev/sdb1", [], "Test", true, "/some/fake/path", "fat32",
"UU82-3O93"}, "AB87-3S21", "TOSHIBA"},
{:disk, "/dev/sdb", "101 GT", "dos",
{:partition, "/dev/sdb2", [], "2Record", false, "fake_point", "exfat",
"som2_3de2"}, "AB87-3S21", "TOSHIBA"}
]}
i want some like this
{:atomic,
[
{:disk, "/dev/sdb", "101 GT", "dos",
[{:partition, "/dev/sdb1", [], "Test", true, "/some/fake/path", "fat32",
"UU82-3O93"}, {:partition, "/dev/sdb2", [], "2Record", false, "fake_point", "exfat", "som2_3de2"}] "AB87-3S21", "TOSHIBA"}
]}
when i tried adding {join, merge} i got the error:
iex(9)> :join_queries.disk_partitions
{:aborted,
{:no_join_to_carry_out,
[
{:qlc, :check_join_option, [join: :merge], [file: 'qlc.erl', line: 2202]},
{:qlc, :prep_join, 3, [file: 'qlc.erl', line: 2062]},
{:qlc, :prepare_qlc, 7, [file: 'qlc.erl', line: 1672]},
{:qlc, :eval, 2, [file: 'qlc.erl', line: 293]},
{:mnesia_tm, :apply_fun, 3, [file: 'mnesia_tm.erl', line: 842]},
{:mnesia_tm, :execute_transaction, 5, [file: 'mnesia_tm.erl', line: 818]},
{:erl_eval, :do_apply, 6, [file: 'erl_eval.erl', line: 685]},
{:elixir, :recur_eval, 3, [file: 'src/elixir.erl', line: 280]},
{:elixir, :eval_forms, 3, [file: 'src/elixir.erl', line: 265]},
{IEx.Evaluator, :handle_eval, 3, [file: 'lib/iex/evaluator.ex', line: 298]},
{IEx.Evaluator, :do_eval, 3, [file: 'lib/iex/evaluator.ex', line: 274]},
{IEx.Evaluator, :eval, 3, [file: 'lib/iex/evaluator.ex', line: 263]},
{IEx.Evaluator, :loop, 1, [file: 'lib/iex/evaluator.ex', line: 157]},
{IEx.Evaluator, :init, 4, [file: 'lib/iex/evaluator.ex', line: 32]},
{:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}
]}}
i readed erlang docs but idk how can i make to work the qlc joins.
Thanks.
First Post!
Kozaky
Hi,
I am currently facing the same issue, looking to make a join with a second table using a list of ids stored in the first table. Were you finally able to find a solution for the merge error?
Thank you in advance
Popular in Questions
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I'm writing a test for one of t...
New
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”:
14:57:30.512 [warn] ...
New
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
Hey,
I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
In AR this is so simple
@articles = current_user.articles
How to do in Ecto?
def index(conn, _params) do
current_user = conn.assig...
New
Other popular topics
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New







