clemensm
Hi everyone
I’ve updated to Ash version 3.24.3 from 3.9.0, and since the update one part of the code no longer works. Basically the situation is like this, there is a main Resource `resource`, another resource `family`, and they are joined using a join table `family_membership`. So they look roughly like this:
defmodule MyApp.FamilyMembership do
use Ash.Resource,
domain: MyApp.Domain,
data_layer: AshPostgres.DataLayer
postgres do
table "family_memberships"
repo MyApp.Repo
end
attributes do
uuid_primary_key :id
end
relationships do
belongs_to :resource, MyApp.MyResource, primary_key?: true, allow_nil?: false
belongs_to :family, MyApp.Family, primary_key?: true, allow_nil?: false
end
end
and both resource have the many_to_many relationship defined, like this for the `resource`:
relationships do
many_to_many :families, MyApp.Family do
through MyApp.FamilyMembership
source_attribute_on_join_resource :resource_id
destination_attribute_on_join_resource :family_id
end
end
and like this for the `family`:
relationships do
many_to_many :resources, MyApp.MyResource do
through MyApp.FamilyMembership
source_attribute_on_join_resource :family_id
destination_attribute_on_join_resource :resource_id
end
end
All three modules are registered in the Domain.
Now when I try to run a query like this:
MyApp.Resource |> Ash.Query.filter(exists(families, id == 8)) |> Ash.read!()
I always get this error, and have no clue how to fix that:
** (Ash.Error.Unknown)
Bread Crumbs:
> Exception raised in: Prices.Data.Part.for_load
Unknown Error
* ** (ArgumentError) `nil` is not a Spark DSL module.
nil.fetch_opt([:multitenancy], :strategy)
(spark 2.6.1) lib/spark/dsl/extension.ex:2162: Spark.Dsl.Extension.get_config_entry_with_fallback/6
(spark 2.6.1) lib/spark/dsl/extension.ex:307: Spark.Dsl.Extension.get_opt/5
(ash_sql 0.3.11) lib/join.ex:604: AshSql.Join.join_prefix/3
(ash_sql 0.3.11) lib/join.ex:600: AshSql.Join.set_join_prefix/3
(ash_sql 0.3.11) lib/join.ex:494: AshSql.Join.related_query/3
(ash_sql 0.3.11) lib/join.ex:348: AshSql.Join.related_subquery/3
(ash_sql 0.3.11) lib/join.ex:909: AshSql.Join.join_relationship/8
(ash_sql 0.3.11) lib/join.ex:161: anonymous fn/10 in AshSql.Join.join_all_relationships/10
(elixir 1.18.4) lib/enum.ex:4968: Enumerable.List.reduce/3
(elixir 1.18.4) lib/enum.ex:2600: Enum.reduce_while/3
(ash_postgres 2.6.25) lib/data_layer.ex:3507: AshPostgres.DataLayer.filter/4
(ash 3.24.3) lib/ash/actions/read/read.ex:88: Ash.Actions.Read.run/3
nil.fetch_opt([:multitenancy], :strategy)
(spark 2.6.1) lib/spark/dsl/extension.ex:2162: Spark.Dsl.Extension.get_config_entry_with_fallback/6
(spark 2.6.1) lib/spark/dsl/extension.ex:307: Spark.Dsl.Extension.get_opt/5
(ash_sql 0.3.11) lib/join.ex:604: AshSql.Join.join_prefix/3
(ash_sql 0.3.11) lib/join.ex:600: AshSql.Join.set_join_prefix/3
(ash_sql 0.3.11) lib/join.ex:494: AshSql.Join.related_query/3
(ash_sql 0.3.11) lib/join.ex:348: AshSql.Join.related_subquery/3
(ash_sql 0.3.11) lib/join.ex:909: AshSql.Join.join_relationship/8
(ash_sql 0.3.11) lib/join.ex:161: anonymous fn/10 in AshSql.Join.join_all_relationships/10
(elixir 1.18.4) lib/enum.ex:4968: Enumerable.List.reduce/3
(elixir 1.18.4) lib/enum.ex:2600: Enum.reduce_while/3
(ash_postgres 2.6.25) lib/data_layer.ex:3507: AshPostgres.DataLayer.filter/4
(ash 3.24.3) lib/ash/behaviour_helpers.ex:62: Ash.BehaviourHelpers.call_and_validate_return/5
(ash 3.24.3) lib/ash/query/query.ex:4769: Ash.Query.maybe_filter/3
(ash 3.24.3) lib/ash/query/query.ex:4520: Ash.Query.data_layer_query/2
(ash 3.24.3) lib/ash/actions/read/read.ex:801: anonymous fn/9 in Ash.Actions.Read.do_read/5
(ash 3.24.3) lib/ash/actions/read/read.ex:1601: Ash.Actions.Read.maybe_in_transaction/3
(ash 3.24.3) lib/ash/actions/read/read.ex:435: Ash.Actions.Read.do_run/3
(ash 3.24.3) lib/ash/actions/read/read.ex:89: anonymous fn/3 in Ash.Actions.Read.run/3
iex:22: (file)
To me it looks like I need to preload the `:families`, but adding a `Ash.Query.load(:families)` does not help at all. Also this was working fine before the upgrade.
Any help on how to fix this is appreciated ![]()
Trending in Questions
Other Trending Topics
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
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #security
- #elixirconf-eu
- #processes
- #api
- #forms
- #hex










Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
The bug is caused by an issue in
ash_postgres. Please updateash_postgresandash_sqlas wellclemensm
Thanks, should have thought about updating those as well….