bibekp
Anyone using joins in Amnesia (Elixir Mnesia wrapper)
Whatever your opinion of Mnesia is, has anyone used joins via qlc - query list comprehension - in an Elixir form?
It appears based on this thread that qlc operates on Erlang style list comprehensions instead of Elixir style. I noticed this Qlc library but this is also Erlang style.
Just curious if anyone has tried this out in Elixir and curious as to the build steps. Without being able to join tables here with qlc wondering how people are joining tables in Mnesia land…
Here’s some erlang qlc from the mnesia chapter of Programming Erlang
do(qlc:q([X#shop.item || X <- mnesia:table(shop),
X#shop.quantity < 250,
Y <- mnesia:table(cost),
X#shop.item =:= Y#cost.name,
Y#cost.price < 2
])).
and the equivalent SQL
SELECT shop.item, shop.quantity, cost.name, cost.price
FROM shop, cost
WHERE shop.item = cost.name
AND cost.price < 2
AND shop.quantity < 250
Most Liked
bibekp
bibekp
Upon further read, it looks like Amnesia supports this, just need to figure out how to go about using the selection constructs with join
# You can also use an Exquisite selector to fetch records.
selection = Message.where user_id == 1 or user_id == 2,
select: content
# Get the values in the selector and print them.
selection |> Amnesia.Selection.values |> Enum.each &IO.puts(&1.content)
1
Popular in Questions
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
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 followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work.
Or rather, not char, but a substr...
New
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217
Let’s say I have a map with required and optional k...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
Other popular topics
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
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
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 followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
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








