Latest #ecto-query Threads Top

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
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
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
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
MatijaL
Hello, I would like to hear your opinion on writing controller/context functions with DB queries. Let’s say that we have an hypothetica...
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
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
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
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
feld
Trying my hardest to reproduce this query with Ecto, but struggling: SELECT DISTINCT("id"), sum("hits") AS hits FROM "stats_daily" WHERE...
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
MatijaL
Hello, I would like to hear your opinion on writing controller/context functions with DB queries. Let’s say that we have an hypothetica...
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
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
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

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
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
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
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
jmedding
Is it possible to use a field from a join in an update. I’m trying to do something like this: Repo.update_all( from(m in Mode...
New
grufino
Hello, I have a User structure that can have multiple accounts (has_many) and can be in multiple team through this accounts (many to man...
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