Arsenalist
I’m sorting by a join field and it’s throwing an error. Here’s the query being executed:
from(p in Product,
left_join: variants in assoc(p, :variants), as: :variants,
left_join: venue_arrangement in assoc(p, :venue_arrangement)
preload: [
variants: variants
]
)
Here are the schemas:
defmodule Amplify.Models.Product do
use Amplify.MedusaSchema
@derive {
Flop.Schema,
filterable: [:showtimes],
sortable: [:showtimes],
adapter_opts: [
join_fields: [
showtimes: [
binding: :variants,
field: :starts_at_utc,
path: [:variants, :utc_datetime]
]
]
]
}
schema "product" do
field :title, :string
has_many :variants, Amplify.Models.ProductVariant
end
end
defmodule Amplify.Models.ProductVariant do
use Amplify.MedusaSchema
schema "product_variant" do
belongs_to :product, Amplify.Models.Product
field :thumbnail, :string
field :starts_at_utc, :utc_datetime
end
end
When I pass in ["showtimes"] as order_directions to flop params and call like this:
Flop.validate_and_run(query, flop_params)
I get:
** (Postgrex.Error) ERROR 42703 (undefined_column) column p0.showtimes does not exist
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
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
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
woylie
You’ll need to pass the schema module. Flop doesn’t infer the schema automatically.
woylie
Unrelated, the
pathoption is used to find the cursor values from the result set in case you use cursor pagination. This should thus be[:variants, :starts_at_utc].Arsenalist
Amazing, thank you. That worked perfectly. This library is eliminating the need to write a ton of code for me. Thank you again!
Arsenalist
Hi, somewhat related, but do you know how I can print the underlying query that Flop creates when appending the LIMIT etc clauses? I know how to print a plain old Ecto query but how do I access the one that Flop creates when running validate_and_run? In dev this automatically prints but I’m trying to debug something i production.
Arsenalist
I find that the LIMIT is not being appended to the query (the total count still returns the right count though).
I have a fairly complex query with about 12 joins, but that should’t matter?
This also appears to work perfectly fine in development, but in production, the limit is not being applied
Arsenalist
Did some digging around and was able to print the query. The query is printed correctly with the right LIMITs applied and everything. When I run the query directly against the DB it works great.
However, Flop doesn’t return all the results from
validate_and_run/3. This is only a problem when there’s a query being passed in. It works fine when you’re just querying a model directly (without joins etc.)Arsenalist
So the issue here was that I wasn’t adding
distinct: p.idin my query. Once I added that it all behaved properly. I’m not sure why that matters since Flop should just return whatever it finds. As an example, here’s what I was seeing: