Closed ricardojmendez closed 9 years ago
Subentities in with-many relation are fetched lazily using separate select statement for each main entity. sql-only
returns only the select for main entity, dry-run
shows also subentity selects:
(dry-run (select users (with sessions)))
dry run :: SELECT "users".* FROM "users" :: []
dry run :: SELECT "sessions".* FROM "sessions" WHERE ("sessions"."creator_id" = ?) :: [1]
=> ({:sessions [{:creator_id 1, :id 1}], :id 1})
Thanks, I guess we can close this as working as intended, but I'd suggest expanding the example documentation to note that.
PRs for the documentation welcome: https://github.com/korma/sqlkorma
Suppose the following entity definition:
Executing:
will indeed return the users and sessions, however:
will only return "SELECT \"users\".* FROM \"users\""