adamlibusa
Is there somebody who could coach me over Skype on Ecto and help me solve a quite trivial problem: Build a tree-like structure of entities, based on a table that references itself. I am ready to pay, if it is a reasonable amount of money.
I feel that either Ecto and Elixir are not the right tools for it, or I simply don’t have enough experience with these tools to figure it out on my own, just with books and tutorials. After about two months of struggling, I am ready to give up on Elixir. And I really don’t want to, because it looks like a neat tool.
Thank you and sorry if this kind of requests doesn’t belong here. I will understand removing it, if that’s the case.
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
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
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
rms.mrcs
So, I see that you wrote this thread a few days ago.
I’m far from a specialist, but maybe I could help. I’ve made something similar to this problem.
From your original post, I think the problem could be in your changesets. Usually all you need is to use
put_assocorcast_assocand Ecto will build your associations in the database. Can you post them?michalmuskala
I replied to a similar question in another thread: Ecto preload for tag has_many tags - #3 by michalmuskala
To summarise, asking “How to do this in ecto” is the wrong question. The right question is “How to do this in SQL”. Ecto, differently from ORMs (and that’s probably the important difference, not the fact that elixir doesn’t have objects), keeps close to the semantics of the underlying data storage and does not try to abstract it. This means that to use Ecto efficiently, one should understand the database.
adamlibusa
Michal, thank you for your answer. Writing up a Postgres query that would load the tree data and make it work took me an hour. And I don’t agree that expressing a precise query for this is not possible: “WITH RECURSIVE” in Postgres or “START WITH … CONNECT BY” in Oracle are tools made exactly for this case.
What drives me nuts is how to build a tree of Ecto entities in memory, using
put_assoc, given that I already have a 2D list of data from the DB (that was the easy part). I will try a couple more things and if they don’t work, I will post my code, as a reaction to rms.mrcs.adamlibusa
rms.mrcs, thanks for the answer. I was doing some research and this post on Stackoverflow helped me realize something:
Working with trees in a compulsory immutable environment will be pain in the ass no matter what. Building trees in Elixir is really hammering nails with a screwdriver. I will probably change the framework, since I don’t want to have to write 300 line module, just to build a simple tree. Thank you for your help though.