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’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
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
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
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
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
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
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #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: