Latest #ecto-query Threads 
I want to model the following relationship:
A location has zero or one of multiple (currently 7) specifications (each specification is a...
New
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
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
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
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
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
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
I have a list like this
selected_fields = [:inbox_count, :phone_number_count, :comment_count, ...] #this list contains fields of a table...
New
I have tried this code:
def my_func(params) do
...
|> select(
[l],
%{
date: fragment("date_trunc('?',?)...
New
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
This Month's Trending
This Year's Trending
Hello people!
I have a requirement to perform a select query with IN clause using tuples. I am using PostgreSQL. Example:
select * from...
New
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
How to convert following Ecto Query into the Plain RAW SQL
%Workspace{name: "#{prefix() || "public"}"} |> Repo.insert()
Your respons...
New
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
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
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
Sometimes, Ecto (actually, DBConnection) spills an error like this:
DBConnection.ConnectionError: ** (DBConnection.ConnectionError) conn...
New
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
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
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
Trying my hardest to reproduce this query with Ecto, but struggling:
SELECT DISTINCT("id"), sum("hits") AS hits
FROM "stats_daily"
WHERE...
New
I have a list like this
selected_fields = [:inbox_count, :phone_number_count, :comment_count, ...] #this list contains fields of a table...
New
I have tried this code:
def my_func(params) do
...
|> select(
[l],
%{
date: fragment("date_trunc('?',?)...
New
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
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
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
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
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
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
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
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
I have a query like:
Alarms
|> preload(:event)
|> order_by([{:desc, :event[:id]}])
|> Repo.all()
You can see what I am tryi...
New
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
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
my original syntax :
result =
Enum.map(
from(Repo, where: ^whitelisted_params)
|> where([schema], like(schema.nama, ^"#{nam...
New
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
How can I write this query in Ecto?
SELECT
*,
(SELECT COUNT(o.id) FROM tenant_versilov.orders o
LEFT OUTER JOIN...
New
My data model is like this
Category has_many Products
Products belongs_to Category
Products belongs_to User
What I want from database...
New
I’m getting this error:
## ** (Ecto.Query.CompileError) Tuples can only be used in comparisons with literal tuples of the same size
fro...
New
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
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
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
Latest on Elixir Forum
Get money off!
The Pragmatic Bookshelf
35% off any eBook
Manning Publications
45% off any item
ElixirCasts
10% off for life
The Pragmatic Studio
20% off any course
AppSignal
10% off for 12 months
Honeybadger
10% off for 12 months
Simply use coupon code "devtalk.com" or "elixirforum" at checkout!
Filter by Type:
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #ash-questions
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #exunit
- #discussion
- #javascript
- #elixirconf
- #library
- #oban-questions
- #dialyzer
- #docker
- #onsite
- #authentication
- #podcasts
- #full-time-contract
- #umbrella
- #code-sync
- #ecto-query
- #phoenix_html
- #iex
- #graphql
- #genstage
- #elixir-ls
- #nerves-questions
- #podcasts-by-brainlid
- #supervisor
- #websockets
- #distillery
- #advent-of-code
- #blog-post
- #livebook-questions
- #processes
- #forms
- #api
- #metaprogramming







