Latest #ecto-query Threads Top

lcabrini
I hope this is the right place to ask this. I’m ultimately using Phoenix, but the question itself is Ecto-specific. I have two tables: o...
New
carlosfritz
I want to model the following relationship: A location has zero or one of multiple (currently 7) specifications (each specification is a...
New
almir-neto
I saw that Ecto repo have the function Repo.stream, but I dont know what the steps happens when a trigger the Stream.run. A query like SE...
New
avilesj
Hello community. I am trying to perform the following query in Ecto SELECT * FROM table t where ARRAY[2, 12] <@ list_of_ids ; The ...
New
dli
I have two schemata Person and Book. Both Book.author_id and Book.illustrator_id reference Person.id. I want to load all books and prel...
New
msw10100
When using postgres, I’d like to query a table where a JSONB column contains a JSON document with a field called members whose value is a...
New
Terbium-135
What am I missing? I am trying to ‘translate’ following SQL query to ecto: SELECT g.groupname, g.id FROM groups AS g LEFT OUTER JOIN un...
New
JasterV
Hello there :slight_smile: I have a schema A that has a one-to-many relationship with a schema B. I want to make a query that lists all...
New
ashleyconnor
I have two schemas which look similar to the example below: defmodule MyApp.Delivery do use Ecto.Schema schema "deliveries" do ...
New
maz
I’m doing a fairly complex join where I want to preload an array of ContentMediaItems (called :contents) that are nested in an associatio...
New

This Week's Trending Top

This Month's Trending Top

This Year's Trending Top

victorolinasc
Hello people! I have a requirement to perform a select query with IN clause using tuples. I am using PostgreSQL. Example: select * from...
New
fireproofsocks
Building off of this older post: What I need to do is to create a few case-insensitive columns in PostGres. I’ve been following this po...
New
avilesj
Hello community. I am trying to perform the following query in Ecto SELECT * FROM table t where ARRAY[2, 12] <@ list_of_ids ; The ...
New
lcabrini
I hope this is the right place to ask this. I’m ultimately using Phoenix, but the question itself is Ecto-specific. I have two tables: o...
New
carlosfritz
I want to model the following relationship: A location has zero or one of multiple (currently 7) specifications (each specification is a...
New

Last Three Year's Trending Top

ycv005
How to convert following Ecto Query into the Plain RAW SQL %Workspace{name: "#{prefix() || "public"}"} |> Repo.insert() Your respons...
New
shahryarjb
Hello, I have read the Ecto query and I see this line: You should be very careful when allowing user sent data to be used as part of LIK...
New
Yama
Sorry for asking something that has been mentioned a few times here but would like some help to get a better understanding. What I’m tryi...
New
msw10100
When using postgres, I’d like to query a table where a JSONB column contains a JSON document with a field called members whose value is a...
New
Owens
I couldn’t find an answer to this from searching so thought I would make a post about it. I’m trying to get a list of Users who have not...
New
gmile
Sometimes, Ecto (actually, DBConnection) spills an error like this: DBConnection.ConnectionError: ** (DBConnection.ConnectionError) conn...
New
marick
I know not to worry about performance before getting evidence of a problem, but I’m idly curious about preloads. (Note: I have fairly lit...
New
la_219
Hello all :blush: Disclaimer: Since this is a work thing, I changed the name of the schemas. The structure is the same. I’m currently w...
New
sid3r
Hello, I’m new to Phoenix and Ecto and having hard time making my own queries, hope you can help me with this one. My situation is prett...
New
fuelen
Hey I want to introduce you a small utility that may help in writing dynamic queries :slight_smile: In a few words, this code: blank_s...
New
fastindian84
Hello Community, I have a question that I can’t figure out why Ecto query work this way. So I have a next table: ...
New
feld
Trying my hardest to reproduce this query with Ecto, but struggling: SELECT DISTINCT("id"), sum("hits") AS hits FROM "stats_daily" WHERE...
New
almir-neto
I saw that Ecto repo have the function Repo.stream, but I dont know what the steps happens when a trigger the Stream.run. A query like SE...
New
DuyDuc94
I have a list like this selected_fields = [:inbox_count, :phone_number_count, :comment_count, ...] #this list contains fields of a table...
New
Vovchikan
I have tried this code: def my_func(params) do ... |> select( [l], %{ date: fragment("date_trunc('?',?)...
New

Trending Over Three Years Top

benonymus
Hey I am returning a list of users from a function, and I want to use that list for a query. how could I use the ids of those items for ...
New
thiagomajesk
Hello everyone, I was working on a project and was faced with this problem and I’d like some input from you on the subject. Imagine this ...
New
polypush135
In short this was what I tried to do. from(q in query, join: va in ^from(va in VideoAnalysis, where: va.id == ^v...
New
Samuel-88
Hello all, I hope everyone is doing all right! A very common task for me is to count the number of entries that match certain criterias...
New
mmport80
I have a query like: Alarms |> preload(:event) |> order_by([{:desc, :event[:id]}]) |> Repo.all() You can see what I am tryi...
New
jmurphyweb
I have a slow query as my data has grown. I wanted to test joining before preloads to see if i could speed it up. I did a test on some m...
New
fireproofsocks
I have once again nose-dived into the treeline while attempting to follow the official docs… I’m trying to stay positive here, but I am r...
New
jihantoro
my original syntax : result = Enum.map( from(Repo, where: ^whitelisted_params) |> where([schema], like(schema.nama, ^"#{nam...
New
e94
Hi, I’m new to Elixir. So sorry if I missed something. I cannot make this query work: alias Uniq.UUID mandate_uuid = "6bf40047-117d-4...
New
Sanjibukai
Hi everybody, Edit for TL;DR: How I can use SQL array_agg aggregate function with an Ecto fragment. Particularly how I can nest the se...
New
versilov
How can I write this query in Ecto? SELECT *, (SELECT COUNT(o.id) FROM tenant_versilov.orders o LEFT OUTER JOIN...
New
freewebwithme
My data model is like this Category has_many Products Products belongs_to Category Products belongs_to User What I want from database...
New
tonarie
Hello, first post here. Sorry I’m not good at explaining things. I have a table of Buses, each of which is associated with one or more S...
New
maz
I’m getting this error: ## ** (Ecto.Query.CompileError) Tuples can only be used in comparisons with literal tuples of the same size fro...
New
PragTob
:wave: Relatively common setup: I have a Thing which has_many SubThing. In the index view (showing many Things) I want to display a li...
New
  • Follow
  • Join
  • Shape
the conversation

Latest on Elixir Forum

Elixir Forum

Similar Portals

    None added yet

We're in Beta

About us Mission Statement